As the method name suggest "toUpperCase()" it is used to convert all the characters given into the string to upper case. This method is useful when you need the generated output into upper case for example while showing the user information..you can conver the first name and last name format into upper case using toUpperCase() string class method.
a simple String.toUpperCase() java example:
public class Uppercase
public static void main(String args)
String str = "convert to upper case java example.";
// to convert the string into Upper Case.
String upper = str.toUpperCase();
// Display the two strings for comparison.
System.out.println("Orignal Value = " + str);
System.out.println("Changed to UpperCase = " + upper );
the output is:
Orignal Value = convert to upper case java example.
Changed to UpperCase = CONVERT TO UPPER CASE JAVA EXAMPLE.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.