0
What's the problem?
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner hello = new Scanner (System.in); String words = caps (hello.nextLine()); System.out.println (words); } public static String caps (String x){ return x.toUpperCase; } }
7 Answers
+ 1
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
String x = scan.nextLine();
x = x.toUpperCase();
System.out.println (x);
}
}
Correct one.
+ 1
toUpperCase
It is a method not a keyword.
There should be pranthesis after this.
x.toUpperCase();
Note:. ()
yahel
+ 1
C ++ thanks !!
0
// return x.toUpperCase;
x = x.toUpperCase();
(...after this answer code in question was changed )
0
We can't return from a method having void return type.
And the other thing., program stop executing the block of code in which return encountered at that line.
Therefore, in this just convert string to uppercase.
0
I edited the post. What's the problem now?
0
I tried another way...