I am supposed to get the first and the last word from a string that is input by a user but im not sure how. Any tips would be great!
//Print the first word and last word from a string
int index = inputString.indexOf(" "); String fistString = inputString.substring(0, index); System.out.println("First Word = "+fistString);
Thats what I have to get the first word. It works but i feel like there is an easier way.