Java String toUpperCase Example
String class toUpperCase method example
String class toUpperCase method example:- This example demonstrates the working of toUpperCase method. this method returns letters of upper cases
Syntax:-toUpperCase()
Here is the code:-
/**
* @(#) ToUpperCaseString.java
* ToUpperCaseString class demonstrates the working of toUpperCase() method of String class of lang package
* @version 16-May-2008
* @author Rose India Team
*/
public class ToUpperCaseString {
public static void main(String args[]) {
// method converts all lower case letters in to upper case letters
// method does not work for arraysv and CharSequence interface and
// primitive types
String heram = "raghu kul wreet sada chali aayee pran jaye par vachan na jaaayeee",
str = "as per einstein there is place called swapna aakash where all divine plans take births everyr moment";
System.out.println("Formatted value of String heram: "
+ heram.toUpperCase());
System.out.println("Formatted value of String str: "
+ str.toUpperCase());
}
} |
Output of the program:-
'Formatted value of String heram: RAGHU KUL WREET SADA CHALI AAYEE PRAN JAYE PAR VACHAN NA JAAAYEEE
'Formatted value of String str: AS PER EINSTEIN THERE IS PLACE CALLED SWAPNA AAKASH WHERE ALL DIVINE PLANS TKE BIRTHS EVERYR MOMENT |
|