hi I know that I have asked pretty much question recently.. I'm learning java myself and hence kinda can't really understand

the isDigit method..
error is cannot resolve symbol method isDigit(char)
I imported java.lang.* as well already .

    public static boolean DigitValidation(String colour)
    {
        boolean flag = true;

        for (int i =0; i<colour.length();i++)
        {
            char ch = colour.charAt(i);
            if (colour.isDigit(ch))
            {
                flag= false;
                break;
            }
            else flag = true;
        }
        return flag;
    }

Recommended Answers

All 3 Replies

well, there is no isDigit method in String, which is what you're calling.
There is a static one in Character, which I guess you're thinking you're calling.
But you need to do that differently, something like Character.isDigit(ch)

er may I enquire how do i use character.isDigit in this place then??

read the language documentation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.