Convert String To UpperCase In Java

Convert String to UpperCase in Java Example describes about Converting a String to UpperCase in Java.

For converting a string to uppercase in java, you can use the following method of String class
 
String toUpperCase()  will transforms all characters of a particular String into upper case characters according to the current locale.
 
String toUpperCase(Locale locale) method will transforms all the characters of a particular String into upper case characters according to the given Locale specified.

Convert String to UpperCase in Java

public class ConvertToUpperCase {

 
public static void main(String[] args) {
  
   
String str = "how are you";
  
   
// Convert to upper case
   
String upper = str.toUpperCase();
  
    System.out.println
(upper);
  
 
}
}
Output
HOW ARE YOU





Your email address will not be published. Required fields are marked *