Javatpoint Logo
Javatpoint Logo

Java Character toUpperCase() Method

The toUpperCase(char ch) method of Character class converts the given character argument to the uppercase using a case mapping information which is provided by the Unicode Data file.

It should be noted that Character.isUpperase(Character.UpperCase(ch)) may not always return true for some characters.

In actual, the String.toUpperCase() can be used to map the characters into uppercase. There are various benefits of String case mapping as compared to Character case mapping. String case mapping can be used to perform local-sensitive mappings, context-sensitive mappings whereas the Character case mapping cannot be used.

Syntax

Parameter

ch: It is the character that needs to be converted.

Return Value

The toUpperCase(char ch)method returns the uppercase of the given character. Otherwise, this method returns the character itself.

Example 1

Test it Now

Output:

The titlecase of character 'm' is given as: M
The titlecase of character 'q' is given as: Q

Example 2

Test it Now

Output:

The uppercase of the character '+' is given as: +
The uppercase of the character 'F' is given as: F


Java Character toUpperCase(int codePoint) Method

The toUpperCase(int codePoint) method of Character class converts the given character(Unicode code point) argument to the uppercase using a case mapping information which is provided by the Unicode Data file.

It should be noted that Character.isUpperase(Character.UpperCase(codePoint)) may not always return true for some characters.

In actual, the String.toUpperCase() can be used to map the characters into uppercase. There are various benefits of String case mapping as compared to Character case mapping. String case mapping can be used to perform local-sensitive mappings, context-sensitive mappings whereas the Character case mapping cannot be used.

Syntax

Parameter

codePoint: It is the codePoint which is the character that needs to be tested.

Return Value

The toUpperCase(int codePoint)method returns the uppercase of the given character(Unicode code point). Otherwise, this method returns the character itself.

Example 1

Test it Now

Output:

The uppercase for the character 'f' is given as: F
The uppercase for the character 'n' is given as: N

Example 2

Test it Now

Output:

The uppercase for the character 'w' is given as: W
The uppercase for the character 'P' is given as: P
Next TopicJava Character




Please Share

facebook twitter google plus pinterest