Page 1 1
APPENDIX D: JAVA PROGRAMMING CHEATSHEET
This appendix summarizes the most commonly-used Java language features in the textbook. Here are the APIs of the most common libraries.
Hello, World.
Editing, compiling, and executing.
Built-in data types.
Declaration and assignment statements.
Page 2 2
Integers.
Floating-point numbers.
Booleans.
Page 3 3
Comparison operators.
Printing.
Parsing command-line arguments.
Math library.
Page 4 4
Java library calls.
Type conversion.
Anatomy of an if statement.
If and if-else statements.
Page 5 5
Nested if-else statement.
Anatomy of a while loop.
Anatomy of a for loop.
Loops.
Page 6 6
Break statement.
Do-while loop.
Switch statement.
Arrays.
Inline array initialization.
Page 7 7
Typical array-processing code.
Two-dimensional arrays.
Inline initialization.
Page 8 8
The full StdOut API.
Our standard output library.
Our standard input library
.
Page 9 9
Our standard drawing library.
.
Our standard audio library.
Command line.
Page 10 10
Redirection and piping.
Functions.
Page 11 11
Libraries of functions.
Our standard random library.
Page 12 12
Our standard statistics library.
Using an object.
Instance variables.
Constructors.
Page 13 13
Instance methods.
Classes.
Page 14 14
Object-oriented libraries.
Java's String data type.
Page 15 15
Java's Color data type.
Our input library.
Page 16 16
Our output library.
Our picture library.
Our stack data type.
Our queue data type.
Page 17 17
Iterable.
The full ST API.
Our symbol table data type.
Page 18 18
The full SET API.
Our set data type.
The full Graph API.