0
Having a problem in jungle camping (code coach)
6 Respuestas
+ 2
You can take the input as complete string. Each sound is space separated. So you can use .split(" ").
String s = input.nextLine();
String[] sounds = s.split(" ");
Now you can use a loop.
+ 3
Using compareTo() is correct in this case, as you are comparing the letters of the String lexicographically. However, the compareTo() method returns an int not a boolean. So you need to use "compareTo(s1) == 0".
+ 2
You will not only getting 3 sounds. Sometimes you will get more, sometimes less.
Sometimes you are using compareTo() instead of equals()
+ 1
Denise Roßberg Thanks a lot, it's solved
0
Denise Roßberg how will I take variable no. of sounds? Also I have a problem in no numerals (another post)
0
s pal Your welcome :)