Character.toUpperCase(): This method is available in java.lang.Character class of Java.
Approach 1: When the argument is of type char.
Syntax:
char java.lang.Character.toUpperCase(char ch)
This method takes one argument of type char as its parameter. This method converts the character argument to uppercase using case mapping information from the UnicodeData file.
Parameters: One parameter is required for this method.
ch: the character to be converted.
Returns: the uppercase equivalent of the character, if any; otherwise, the character itself.
Exceptions: NA
Java
public class CharactertoUpperCasechar {public static void main(String[] args) {char ch = 'a';System.out.println(Character.toUpperCase(ch));}}
Output:
A
Approach 2: When the argument is of type int.
Syntax:
int java.lang.Character.toUpperCase(int codePoint)
This method takes one argument of type int as its parameter. This method converts the character (Unicode code point) argument to uppercase using case mapping information from the UnicodeDatafile.
Parameters: One parameter is required for this method.
codePoint: the character (Unicode code point) to be converted.
Returns: the uppercase equivalent of the character, if any; otherwise, the character itself.
Exceptions: NA
Java
public class CharactertoUpperCaseint {public static void main(String[] args) {int codePoint = 'a';System.out.println(Character.toUpperCase(codePoint));}}
Output:
No comments:
Post a Comment