Java examples for Language Basics:String
Use the toUpperCase() and toLowerCase() methods.
import java.util.Locale; public class Main { public static void main(String[] args){ String str = "This String will change case."; //from w w w. j av a 2 s . c om System.out.println(str.toUpperCase()); System.out.println(str.toLowerCase()); System.out.println(str.toUpperCase(Locale.ITALIAN)); System.out.println(str.toUpperCase(new Locale("it","US"))); System.out.println(str.toLowerCase(new Locale("fr", "CA"))); } }