Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 358 Bytes

integer.md

File metadata and controls

22 lines (18 loc) · 358 Bytes

Integer

The type to use for an int that might be null is Integer.

~void main() {
Integer i = null;
System.out.println(i);
i = 5;
System.out.println(i);
~}

If you try to do any math on an Integer which holds null you will get a NullPointerException.

~void main() {
Integer i = null;
System.out.println(i * 5);
~}