Here is my code: import java.util.Scanner;
class namedisplay {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
System.out.println("Enter your name: ");
String name = input.nextLine();
String capital1 = name.substring(0).toUpperCase();
String capital2 = name.substring(5).toUpperCase();
System.out.println(capital1+capital2);
}
}
The program output: Enter your name: anna lee ANNA LEELEE
What I want the program to do is to capitalize only the first letters of the first name and last name, for example, Anna Lee.