Java Examples - Convert String Lowercase to Uppercase
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 EXAMPLEOther Extensions
Java Examples