Home  >  Article  >  Java  >  Java example - convert string from lower case to upper case

Java example - convert string from lower case to upper case

黄舟
黄舟Original
2017-02-22 09:42:092040browse

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

//StringToUpperCaseEmp.java 文件public class StringToUpperCaseEmp {
   public static void main(String[] args) {
      String str = "string abc touppercase ";
      String strUpper = str.toUpperCase();
      System.out.println("Original String: " + str);
      System.out.println("String changed to upper case: "
      + strUpper);
   }}
The output result of the above code example is:
Original String: string abc touppercase 
String changed to upper case: STRING ABC TOUPPERCASE

The above is the Java example - string lowercase Convert the content to uppercase. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn