How can i do this?


Ad

Advertisements

Joined
Jan 8, 2022
Messages
11
Reaction score
0
i did that but it didn't work. here is the code

public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.println("Put in your letter");
char c = reader.next().charAt(0);
if (Character.isUpperCase); {
System.out.println("your letter is uppercase");
} if (Character.isLowerCase); {
System.out.println("Your letter is lowercase");
}
}
 
Joined
Mar 3, 2021
Messages
243
Reaction score
29
Those are functions, the first argument of which is the character to check. E.g.,

Code:
Character.isUpperCase(c)
 
Ad

Advertisements

Joined
Jan 24, 2022
Messages
30
Reaction score
1
To check the letter for uppercase or lowercase you need to use the Character. Like for uppercase UpperCase(), method and similar to this for lowercase only change are LowerCase().
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top