Convert char to uppercase java

You can use Charater class’s touppercase method to convert char to uppercase in java.


Method signature

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.

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

That’s all about how to convert char to uppercase in java.

[social_share share_on="facebook,twitter,linkedin,whatsapp"][post_navigator in_same_term="true"]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.