Java String toUpperCase

The java string toUpperCase() method returns the string in uppercase letter. In other words, it converts all characters of the string into upper case letter.
The toUpperCase() method works same as toUpperCase(Locale.getDefault()) method. It internally uses the default locale.

Signature

There are two variant of toUpperCase() method. The signature or syntax of string toUpperCase() method is given:

public String toUpperCase()  
public String toUpperCase(Locale locale)   
The second method variant of toUpperCase(), converts all the characters into uppercase using the rules of given Locale.

Returns

string in uppercase letter.

Java String toUpperCase() method example

public class StringUpperExample{  
public static void main(String args[]){  
String s1="hello catchmecoder";  
String s1upper=s1.toUpperCase();  
System.out.println(s1upper);  
}}  

Output:

HELLO CATCHMECODER

Java String toLowerCase()

The java string toLowerCase() method returns the string in lowercase letter. In other words, it converts all characters of the string into lower case letter.
The toLowerCase() method works same as toLowerCase(Locale.getDefault()) method. It internally uses the default locale.

Signature

There are two variant of toLowerCase() method. The signature or syntax of string toLowerCase() method is given:

public String toLowerCase()  
public String toLowerCase(Locale locale)
The second method variant of toLowerCase(), converts all the characters into lowercase using the rules of given Locale.

Returns

string in lowercase letter

Java String toLowerCase() method example

public class StringLowerExample{  
public static void main(String args[]){  
String s1="CATCHMECODER HELLO rAj";  
String s1lower=s1.toLowerCase();  
System.out.println(s1lower);  
}}         

Output:

catchmecoder hello raj

Java String valueOf

The java string valueOf() method converts different types of values into string. By the help of string valueOf() method, you can convert int to string, long to string, boolean to string, character to string, float to string, double to string, object to string and char array to string.

Signature

The signature or syntax of string valueOf() method is given:

public static String valueOf(boolean b)  
public static String valueOf(char c)  
public static String valueOf(char[] c)  
public static String valueOf(int i)  
public static String valueOf(long l)  
public static String valueOf(float f)  
public static String valueOf(double d)  
public static String valueOf(Object o)

Returns

string representation of given value

Java String valueOf() method example

public class StringValueOfExample{  
public static void main(String args[]){  
int value=50;  
String s1=String.valueOf(value);  
System.out.println(s1+20); //concatenating string with 10  
}}      

Output:

5010