Tutorials Point


  Java Basics Examples
  Java Tutorial
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java Examples - Converting into uppercase


previous next AddThis Social Bookmark Button


Problem Description:

How to convert a string totally into upper case?

Solution:

Following example changes the case of a string to upper case by using String toUpperCase() method.

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);
   }
}

Result:

The above code sample will produce the following result.

Original String: string abc touppercase 
String changed to upper case: STRING ABC TOUPPERCASE 


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names