Java toUpperCase() 方法


Java toUpperCase() 方法

toUpperCase() 方法用于将小写字符转换为大写。

语法

char toUpperCase(char ch)

参数

  • ch -- 要转换的字符。

返回值

返回转换后字符的大写形式,如果有的话;否则返回字符本身。

实例

public class Test {

    public static void main(String args[]) {
        System.out.println(Character.toUpperCase('a'));
        System.out.println(Character.toUpperCase('A'));
    }
}

以上程序执行结果为:

A
A