I am a beginner in
Java. I have a
String as below:
public class Name {
public static void main(String[] args) {
String s = "John Doe";
String s1 = "Jane White";
System.out.println();
}
}
Now I want to print First name and last name seperately. How do I do this? I know I can write code as s.substring(0,4) or vice versa. But if you have a list of names you cant go about writing (0,3) or (0,5) simultaneously. You can seperate the FirstName and LastName from its space. How do you do that? Please help!
Thanks.