Java – tolower case (char) method?
•
Java
Obviously, there is a method that accepts a char and returns a char: http://download.oracle.com/javase/6/docs/api/java/lang/Character.html#toLowerCase (char)
But I can't seem to make it work My code:
import java.lang.Character;
public class Test {
public static void main(String[] args) {
char c = 'A';
c = toLowerCase(c);
System.out.println(c);
}
}
When I compiled it, I received the following error:
$javac Test.java
Test.java:6: cannot find symbol
symbol : method toLowerCase(char)
location: class Test
c = toLowerCase(c);
^
1 error
What on earth did I do wrong? thank you.
Solution
Tolowercase is a static method, so you need to qualify it with the class it belongs to, such as
Character.toLowerCase(c);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
