oadams oadams - 1 year ago 69
Java Question

toLowerCase(char) method?

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 seem to get it to work. My code:

import java.lang.Character;

public class Test {
public static void main(String[] args) {
char c = 'A';
c = toLowerCase(c);

When I compile this, I get 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 am I doing wrong? Thanks.

Answer Source

toLowerCase is a static method, as such you need to qualify it with the class it belongs to, as