Ah thank for the help Josh much better without a loop:)
i just have one more problem.
I have to methods that get the data for a string and the array. But when i return to main i dont think the data put in by the methods is stored?
-
-
public static void main(String[] args) {
-
-
String sentence = new String();
-
char alphabet[] = new char [26];
-
-
GetString(sentence);
-
GetAlphabet(alphabet);
-
-
}
-
public static void GetString (String sentence) {
-
-
System.out.println("Please enter a string: ");
-
sentence = Keybd.in.readLine();
-
-
return;
-
-
}
-
-
public static void GetAlphabet (char alphabet[]) {
-
-
alphabet= "abcdefghijklmnopqrstuvwxyz ".toCharArray();
-
-
return;
-
}
-
Not sure the array and string dont return the data because arent all complex data types stored by reference? If i had a a system.out.print to display the string and array index in mian it wont show anyrthing?