char is a Java primitive type, and thus not an actual object. If you where to change it to be a String or some thing that error would go away, and, in fact, String is possibly the type it's meant to be since the length method is used. Admittedly it could be nearly any object, but String length method has meaning (String is an object btw).