toLowerCase(char) method?

前端 未结 8 1549
醉酒成梦
醉酒成梦 2021-02-14 17:19

Apparently there is a method that takes a char and returns a char: http://download.oracle.com/javase/6/docs/api/java/lang/Character.html#toLowerCase(char)

But I can\'t s

8条回答
  •  广开言路
    2021-02-14 17:31

    "Character" class is used to perform operations on characters of string i.e. to convert character into uppercase, to lower case etc.These methods are "static", So they do not need objects to call them.can be called by class name.

    Example: toLowerCase() method of Character class Character.toLowerCase(char ch) converts the character ch argument to lowercase.

    Corrected program is as below:

    import java.lang.Character;
    public class Test {
    public static void main(String[] args) {
        char c = 'A';
        c = Character.toLowerCase(c);
        System.out.println(c);
       }
    }
    

    Just add the Character before the method toLowerCase() method,because the method is static and should be called by class name.

    For more Details Refer following link: http://www.tutorialspoint.com/java/lang/character_tolowercase.htm

提交回复
热议问题