I have a presentation about capitalize the first letter of each word of a sentence
I write a program like that :
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.print("Input a Sentence: ");
String line = in.nextLine();
String upper_case_line = "";
Scanner lineScan = new Scanner(line);
while(lineScan.hasNext()) {
String word = lineScan.next();
upper_case_line += Character.toUpperCase;
}
System.out.println(upper_case_line);
}
But it gives some error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: variable toUpperCase
location: class java.lang.Character
at javastackoverflow.NewClass1.main(NewClass1.java:15)
C:\Users\Hp\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 9 seconds)
What is the error ?