Java Examples - Convert String Lowercase to Uppercase

Java 实例Java Examples

The following example uses the String toUpperCase() method to convert the string from lowercase to uppercase:

StringToUpperCaseEmp.java file

public class StringToUpperCaseEmp { public static void main(String[] args) { String str = "string example"; String strUpper = str.toUpperCase(); System.out.println("Original string:" + str); System.out.println("Converted to uppercase:" + strUpper); } }

The output of the above code example is:

原始字符串: string example
转换为大写: STRING EXAMPLE

Java 实例Java Examples

Other Extensions