Show Menu
Cheatography

Java OOP Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Main

public class MyAppEntryPoint {
    public static void main(String[] args) {
        // args[0] is the first command-line argument
    }
}

Constr­uction

public class MySubClass 
extends TheSuperClass
{
    // default constructor
    public MySubClass() {
        super(); // calls TheSuperClass' constructor. Must be called first.
        // the above line can be omitted; the call to TheSuperClass' default constructor is performed implicitly.
    }
    // additional constructor
    public MySubClass(int i) {
        this(); // calls above MySybClass' constructor. Must be called first.
    }
}