CrewdNBasic
CrewdNBasic

Reputation: 171

cannot find symbol with isLowerCase

I took this code directly out of Thinking in java 4th edition and it keeps giving me 'cannot find symbol: method isLowerCase(Char). Is the book wrong, do I maybe not have the character class with all my files, or am I doing a really really really stupid mistake?

public class ListCharacters{
    public static void main(String[] args) {
        for(char c = 0; c < 128; c++)
            if(Character.isLowerCase(c))
                System.out.println("value:"+(int)c+ " character: " + c);
    }
}

Upvotes: 0

Views: 1031

Answers (2)

Luke Woodward
Luke Woodward

Reputation: 64979

Do you have a class called Character in the same folder as your ListCharacters class?

On its own, your ListCharacters class compiled fine for me. However, when I added a class called Character to the same folder, I got a 'cannot find symbol' error for the isLowerCase method.

Upvotes: 1

JTeagle
JTeagle

Reputation: 2196

There's nothing wrong with the name of the method or how it's been used, so I'm afraid it does suggest your Java installation has a problem. What version of the JDK have you installed? As far as I can tell isLowerCase() has always been there so I'm not quite sure what could be wrong. Are you compiling from a plain text file using the command-line Java compiler, or using an IDE such as Eclipse? It might be that if you're using an IDE then you haven't pointed it to the correct version of Java.

Upvotes: 0

Related Questions