public class UpLower {
public static void main(String[] args) {
String str = "HOW ARE YOU";
String upper_str = str.toLowerCase();
System.out.println("Original String: " + str);
System.out.println("String in uppercase: " + upper_str);
}
}
This program converts the string from upper to lower character. I can't understand this program.
My questions is
method toLowerCase() is in String class which is in lang package.In java, we need to create an object for the class to access the non-static
methods of that class. If that is the case, without creating object for the class String how can we directly access the method toLowerCase().