public myClass(String someWords, String theList )
{
super();
}
I'm sorry I'm not sure how to convert the string referenced by the argument someWords...
Type: Posts; User: av8
public myClass(String someWords, String theList )
{
super();
}
I'm sorry I'm not sure how to convert the string referenced by the argument someWords...
Constructors are my weakness I am very very new to OOP and the contructors I have written in the past
are very basic, I am not sure how to start with this one!
rgds,
Hello
I need to write a constructor for a class called myClass that takes 2 string arguments (1 called someWords and another called theList).
The constructor needs to convert the string...
Yes thankyou Norm it worked A OK.
I have tried String [] text = {"late" ,"train", "is", "again", "the"}; with the curlys instead of []
text.split(",");
and still get an error do i need to use import java.util.*;
split(String regex, int limit)
These are the arguments in the API but to be honest I dont know what they mean or how to implement them.
rGds
String [] text = ["late" ,"train", "is", "again", "the"];
text.split(",");
for ( int i = 0; i < text.length; i++)
{
System.out.println(text[i]);
}
Hi Ladies and Gents,
I'm trying to teach myself about sets from scratch and the uses of them and I have thought of a method that could be useful.
If I had a method called for example ...
Thank you Norm for your patience
for(int count = 0; count < aString.length(); count++)
{
DisplayLetter(aString.charAt(count));
}
I had missed out the curlys, program works now. thanks...
Another scenario
String String1 = new String();
String1 = "bubble";
String1.charAt(0);
String1.charAt(1);
String1.charAt(2);
String1.charAt(3);
Sorry,
String aString = new String();
aString = "bubble";
for(int count = 0; count < aString.length(); count++)
DisplayLetter(aString.charAt(count));
for(int count = 0; count < aString.length(); count++)
DisplayLetter(aString.charAt(count));
Thanks Norm I've tried this and it displays only the last letter e.
Can you advise on the syntax how to put the loop index into the method call.
Thank you.
I'm getting there slowly. I can have the loop counter as an actual parameter to itererate through a string object
DisplayLetter(String1.charAt(for (int count= 0; count < aString.length; count++));...
String String1 = new String();
String1 = "bubble";
My method : DisplayLetter(char aChar);
If I execute
displayLetter(String1.charAt(4)) actually does work!!
cheers
String1.charAt(4) should work as is. Yes it does, it returns the letter l, but then how do i input this result into another method that only takes a char as an
argument.
...
I tried:
String1.charAt(4) = char aChar;
I get: Syntax error: column 21. Encountered: char
String String1 = new String();
String1 = "bubble";
String1.charAt(4);
I want to input the result of String1.charAt(4); which is the letter l into a method which only takes a char as an...
I dont quite know how to incorporate the loop statement with everything else - sorry just not syntactically or semantically there!
Sorry for (int i = 0; i < string.length; i++) ?
CORRECTION for (char aChar = 0; achar < 4; achar++); something like this for HELLO ?
for (char aChar = 0; char < 4; char++); something like this for HELLO ?
Hi Norm , how could I write a loop to iterate over the String and get the char one by one?