Java Programming Cheatsheet

Java Programming Cheatsheet

·

5 min read

Here is the quick reference for Java Programming I found on the web. It summarizes common features and usage in shortest and easiest way possible.

This is just a blog post taking useful content published on Princeton University's site as part of some course. Do visit original site here for additional resources. For the good intend to share the knowledge with other users and programmers. No intention of modifying or removing credits. Just thought to share this awesome resource with everyone. For more in depth reference, above link to university's website is advised. It is well documented with excellent documentation and programming examples. Note that some examples below are custom code written by authors and I have denoted it by adding "Custom Implementation" to the topic name.

Original authors and work credit goes to Robert Sedgewick and Kevin Wayne as mentioned in the original website of Princeton University computer science department. All thanks to them for their hard work work and making it available to everyone on the web.

Hello, World.

hello.png

Editing, compiling, and executing.

developing.png

Built-in data types.

built-in.png

Declaration and assignment statements.

assignment.png

Integers.

int.png

int-expressions.png

Floating-point numbers.

double.png

double-expressions.png

Booleans.

boolean.png

boolean-ops.png

Comparison operators.

comparison-ops.png

comparison-expressions.png

Printing.

system.out.print-api.png

Parsing command-line arguments.

parse-api.png

Math library.

math-api.png

The full java.lang.Math API.

Java library calls.

library-calls.png

Type conversion.

casts.png

Anatomy of an if statement.

if.png

If and if-else statements.

if-else.png

Nested if-else statement.

nested-if-else.png

Anatomy of a while loop.

while.png

Anatomy of a for loop.

for.png

Loops.

for-while.png

Break statement.

break.png

Do-while loop.

do-while.png

Switch statement.

switch.png

Arrays.

array.png

Inline array initialization.

array-init.png

Typical array-processing code.

array-examples.png

Two-dimensional arrays.

array2d.png

Inline initialization.

array2d-init.png

Standard output library (Custom Implementation).

stdout-api.png

The full StdOut API.

printf.png

printf-formatting.png

Standard input library (Custom Implementation).

stdin-api.png

The full StdIn API.

Standard drawing library (Custom Implementation).

stddraw-api.png

The full StdDraw API.

Standard audio library (Custom Implementation).

stdaudio-api.png

The full StdAudio API.

Command line.

command.png

Redirection and piping.

redirect-stdout.png

redirect-stdin.png

piping.png

Functions.

function.png

function-examples.png

Libraries of functions.

library.png

Standard random library (Custom Implementation).

stdrandom-api.png

Standard statistics library (Custom Implementation).

stdstats-api.png

Using an object.

object.png

Instance variables.

instance-variables.png

Constructors.

constructor.png

Instance methods.

instance-method.png

Classes.

class.png

Object-oriented libraries.

library-oop.png

Java's String data type.

string-api.png

The full java.lang.String API.

string-ops.png

Java's Color data type.

color-api.png

The full java.awt.Color API.

Input library (Custom Implementation).

in-api.png

The full In API.

Output library (Custom Implementation).

out-api.png

The full Out API.

Picture library (Custom Implementation).

picture-api.png

The full Picture API.

Stack data type (Custom Implementation).

stack-api.png

The full Stack API.

Queue data type (Custom Implementation).

queue-api.png

The full Queue API.

Iterable.

iterable-anatomy.png

Symbol Table data type (Custom Implementation).

st-api.png

The full ST API.

Set data type (Custom Implementation).

set-api.png

The full SET API.

Graph data type (Custom Implementation).

graph-api.png

Bookmark this right away for reference in future. Do share and help others learn if you have too.