Advertisement
public String toUpperCase()
//Program to convert a String to upper case letters.
class StringUpper
{
public static void main(String[] ar)
{
String str= new String("new zealand");
System.out.println("Original String is : "+ str);
System.out.println("String's upper case value : " + str.toUpperCase());
}
}
String's value : new zealand
String's upper case value : NEW ZEALAND
//Program to convert a String to upper case letters.
class StringUpper
{
public static void main(String[] ar)
{
String str= new String("mars - the red planet");
System.out.println("Original String is : "+ str);
System.out.println("String's upper case value : " + str.toUpperCase());
System.out.println("String value : " + str);
}
}
String's value : mars - the red planet
String's upper case value : MARS - THE RED PLANET
String's value : mars - the red planet
Advertisement
//Program to convert a string to Uppercase letters.
class StringUpper2
{
public static void main(String[] ar)
{
String str = new String("hurray! it's sunday!");
System.out.println("Original string is : "+ str);
str = str.toUpperCase(); //result of calling the toUpperCase() method
System.out.println("String's value after converting to UpperCase : " + str);
}
}
Original string is : hurray! it's sunday!
String's value after converting to upper case : HURRAY! IT'S SUNDAY!
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement