Search lessons

Suggested searches

Browse

MainSame

public class MainSame {
    
    public static void main(String[] args) {
        Other o = new Other();
        System.out.println(o.privateNumber); // This will not work, nothing outside of the class Other can access private
        System.out.println(o.defaultNumber); // This will work, since MainSame is in the same folder
        System.out.println(o.publicNumber); // This will work, since anything can access public

        o.privatePrint(); // This will not work, nothing outside of the class Other can access private
        o.defaultPrint(); // This will work, since MainSame is in the same folder
        o.publicPrint(); // This will work, since anything can access public
    }
}

Progress is available when JavaScript is enabled.

Manage progress

Progress is saved only in this browser. Export a copy to move it to another device.

Opening a lesson marks it complete on this browser. That records a visit, not understanding or a quiz score. Test yourself with the knowledge checks and labs. How progress works

Edit this lesson · View source