Convert string to uppercase in Java
Description
The following code shows how to convert string to uppercase.
Example
/* w w w . java 2s. com*/
import java.util.Locale;
public class Main {
public static void main(String[] argv) {
System.out.println(toUpperCase("this is a test from java2s.com"));
}
public static String toUpperCase(String s) {
return s.toUpperCase(Locale.ENGLISH);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »