Java Access Modifiers

There are different types of class - this one is an inner class so the enclosing class (your sketch) has access to all its attributes no matter what the specifier.
Change the class to a top-levl class with
public static class cMyClass {
and see what happens