0

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;
    }

Edited by pyTony: fixed formating

2
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by jwenting
0

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)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.