Hi,
I use the Arrays.sort() method to sort the aray of Strings.
Then, I use a for loop and compare if the first string is equal to the second.
I get the logic, but I'm getting an array index out of bounds exception.
Please help.
Given a string "y z z x y z";
The desired output is ->"z" occurs 3 times
Kudos!
Faisal
I use the Arrays.sort() method to sort the aray of Strings.
Then, I use a for loop and compare if the first string is equal to the second.
I get the logic, but I'm getting an array index out of bounds exception.
Please help.
Given a string "y z z x y z";
The desired output is ->"z" occurs 3 times
Kudos!
Faisal