Table of Contents
You can use Charater class’s touppercase method to convert char to uppercase in java.
Method signature
1 2 3 |
public static char touppercase(char ch) |
Parameters
ch is primitive character type.
Return type
return type is char. If char is already uppercase then it will return same.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
package org.arpit.java2blog; public class JavaToUpperCaseMain { public static void main(String[] args) { System.out.println(Character.toUpperCase('a')); System.out.println(Character.toUpperCase('Y')); System.out.println(Character.toUpperCase('f')); System.out.println(Character.toUpperCase('u')); } } |
When you run above program, you will get below output:
A
Y
F
U
Y
F
U
That’s all about how to convert char to uppercase in java.
Was this post helpful?
Let us know if this post was helpful. Feedbacks are monitored on daily basis. Please do provide feedback as that\'s the only way to improve.