Actually i wanted to check the condition that the input sentence has its first letter already in capital The code below is converting the lowercase character of first letter in the string to upper case i wanted to add the line if suppose user enter a string like "I Am Human Being" means in this the first character is already in upper case then how to add a line to the existing code
Scanner sc=new Scanner(System.in);
String line=sc.nextLine();
String uc="";
Scanner line_sc=new Scanner(line);
while(line_sc.hasNext()) {
String word=line_sc.next();
uc+=Character.toUppercase(word.charAt(0))+ word.substring(1)+" ";
}
System.out.println(uc.trim());