Home >>Java String Methods >Java String toUpperCase() Method

Java String toUpperCase() Method

Java String toUpperCase() Method

The toUpperCase() method in Java String is used to converts a string to upper case letters.

Syntax

public String toUpperCase()

Parameters

None

Returns

It is used to return A String value which represents the new string converted to upper case

Java String toUpperCase() Method Example 1


public class MyClass 
{
  public static void main(String[] args) 
  {
    String txt1 = "Hello Phptpoint";
    System.out.println(txt1.toUpperCase());
    System.out.println(txt1.toLowerCase());
  }
}

Output:
HELLO PHPTPOINT
hello phptpoint

Java String toUpperCase() Method Example 2


public class MyClass
{  
public static void main(String args[])
{  
String n1="welcome tO PHptPoint World";  
String s1upper=n1.toUpperCase();  
System.out.println(s1upper);  
}
}  

Output:
WELCOME TO PHPTPOINT WORLD