Base Data Types
byte 1Whole numbers -128 to 127
short 1Whole numbers -32768 to 32767
int 1Whole numbers -2147483648 to 2147483647
long 1LWhole numbers -9223372036854775808 to 9223372036854775807
float 0.1fFloating numbers 3.4e^-38 to 3.4e^38
double 0.2dFloating numbers from 1.7e^-308 to 1.7e^308
char 'a'Single character
boolean true / false
String "SyntaxNut"Concat with +
Special chars \n, \r, \t, \b, \f, \', \", \\
Container Types
List List<Type> list = new ArrayList();
Map Map<TypeKey, TypeValue> map = new HashMap();
Set Set<Type> set = new HashSet();
Array Type[] array = new Type[size];
Flow Control
if / else / else if
if (boolean expression) {
    // statements
} else if (boolean expression) {
    // statements
} else {
    // statements
}
while
while (boolean expression) {
    // statements
}
do while
do {
    // statements
} while (boolean expression);
for loop
for (int i = 0; i < size; i++) {
    // statements
}
for each
for (Type var : collection) {
    // statements
}
switch / case / default
switch(var) {
    case varValue1:
        // statements
        break;
    case varValue2:
        // statements
        break;
    default:
        // statements
}
try / catch / finally
try {
    // statements
} catch (Exception e) {
    // statements
} finally {
    // statements
}
try resource / catch / finally
try (Closeable closable = ...) {
    // statements
} catch (Exception e) {
    // statements
} finally {
    // statements
}
function
public Type functionName(Type arg1) {
    // statements
    return value;
}

private static void functionName() {
    // statements
}
Hello World
public class Main {
    public static void main(S​tring[] args) {
​​​​        Sys​tem.ou​t.p​rin​tln​("Hello world!");​​​
    }
}
Boolean Logic
Comparisons <, <=,>, >=, ==, !=
And && Short circuits.
& Bitwise / No short-circuiting
Or || Short circuits.
| Bitwise / No short-circuiting
Negate !(boolean expression)
Arithmetic Operators
Add +
Subtract -
Multiply *
Divide /
Modulus %
Increment i++ post
++i pre
i += 1; assignment
Decrement i-- post
--i pre
i -= 1; assignment