Appendix D: Java Programming Cheatsheet


출처 :

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.

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

The full java.lang.Math API.

Java library calls.

Expressions that use Java library methods

Type conversion.

Type conversion

If and if-else statements.

If-else statements

Nested if-else statement.

Nested if-else statements in Java

While loops.

While loop

For loops.

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.

Typical array-processing code

Two-dimensional arrays.

2D array

Inline initialization.

2D array inline initialization

Our standard output library.

Standard output API

The full StdOut API.

Anatomy of printf

Formatting codes for printf

Our standard input library.

Standard input API

The full StdIn API.

Our standard drawing library.

Standard drawing API

The full StdDraw API.

Our standard audio library.

Standard audio API

The full StdAudio API.

Redirection and piping.

Redirecting standard output                Redirecting standard input



Anatomy of a function

Example functions

Libraries of functions.

Library abstraction

Our standard random library.

Standard random

Our standard statistics library.

Standard statistics

Using an object.

Using an object

Creating 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

The full java.lang.String API.

String operations

Java’s Color data type.

Color library API

The full java.awt.Color API.

Our input library.

Input API

The full In API.

Our output library.

Output API

The full Out API.

Our picture library.

Picture API

The full Picture API.

Our stack data type.

Stack API

The full Stack API.

Our queue data type.

Queue API

The full Queue API.

Our symbol table data type.

Symbol Table API

The full ST API.

Our set data type.


The full SET API.

Our graph data type.

Graph API

The full Graph API.

Compile-time and run-time errors.

Here’s a list of errors compiled by Mordechai Ben-Ari. It includes a list of common error message and typical mistakes that give rise to them.

Copyright © 2002–2012 Robert Sedgewick and Kevin Wayne. All rights reserved.


About KENNETH 17506 Articles

Be the first to comment

Leave a Reply

Your email address will not be published.


이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.