Java Programming Cheatsheet

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 from Princeton University’s site. 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. 

Hello, World.

Hello, World in Java

Editing, compiling, and executing.

Compiling Hello, World in Java

Built-in data types.

Built-in types of data

Declaration and assignment statements.

Assignment statements


int data type

Integer expressions

Floating-point numbers.

double data type

double expressions


boolean data type

Boolean operators

Comparison operators.

Comparison operators

Comparison examples



Parsing command-line arguments.

parsing Command-line arguments

Math library.

Math library API

Java library calls.

Expressions that use Java library methods

Type conversion.

Type conversion

Anatomy of an if statement.

anatomy of an if statement

If and if-else statements.

If-else statements

Nested if-else statement.

Nested if-else statements in Java

Anatomy of a while loop.

While loop

Anatomy of a for loop.

For loop


While and for loops in Java

Break statement.

Break statement in Java

Do-while loop.

Do-while loop in Java

Switch statement.

Switch statement in Java


An array

Inline array initialization.

Inline initialization of arrays

Typical array-processing code

Two-dimensional arrays.

2D array

2D array inline initialization

standard output library.

Standard output API

Anatomy of printf

Formatting codes for printf

standard input library.

Standard input API

standard drawing library.

Standard drawing API

standard audio library.

Standard audio API

Command line.

command line

Redirection and piping.

Redirecting standard output                Redirecting standard input



Anatomy of a function

Example functions

Libraries of functions.

Library abstraction

standard random library.

Standard random

standard statistics library.

Standard statistics

Using an object.

Using an object

Instance variables.

Anatomy of instance variables


Anatomy of a constructor

Instance methods.

Anatomy of an instance method


Anatomy of a class

Object-oriented libraries.

Object-oriented library abstraction

Java’s String data type.

String library API

String operations

Java’s Color data type.

Color library API

input library.

Input API

output library.

Output API

picture library.

Picture API

stack data type.

Stack API

queue data type.

Queue API


Anatomy of an iterable

symbol table data type.

Symbol Table API

set data type.


graph data type.

Graph API



Pass it on and help others learn if you have too.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s