1 2 3 4 5 6 7 8 9 10 | public class StringCaseChange { public static void main(String[] args) { String sentence="Welcome to Java World"; String upperSentense=sentence.toUpperCase(); System.out.println("Sentence in upper case : "+upperSentense); String lowerSentense=sentence.toLowerCase(); System.out.println("Sentence in lower case : "+lowerSentense); } } |
toUpperCase() and toLowerCase() are methods in String
class which converts given string in upper and lower case respectively and return a string.