Академический Документы
Профессиональный Документы
Культура Документы
for (in
char
case for
boolean b = false;
if (x <= 0)
System.out.println(Invalid value for x: + x);
return
else
while (x != 0)
System.out.println(--x);
ISBN 1-58663-916-1
System.out.println( x equals 0 );
9 781586 639167
switch // picks random numbers r, stops when 0.6 < r < 0.7 Object
double r = Math.random(); Object
Date while (!( r > 0.6 && r < 0.7)) {
LinkedListMyAmazingClass if (x < y) System.out.println( r );
System.out.println(x is less than + y); r = Math.random(); }
if (isTrue) {
do do while
x++;
do
System.out.println(Added one to x. );}
intdouble Object
true
StringTokenizer
do {
if if
execute code statements here
} while (condition); publi
boolean
type varName; publi
for for
trueelse
false
if (condition) {
for ( ; ; )
execute code statements here }
else { for
This downloadable PDF copyright 2004 by SparkNotes LLC. SPARKCHARTS JAVA Papers page 1 of 4
tln(No!);
tln(Invalid input!);
Math
double cos = Math.cos( angle );
for ( ; ; )
dition; increment) {
for while
ments here }
ign x the value of number
e current value of x to 0
for
x);
0);
This downloadable PDF copyright 2004 by SparkNotes LLC. SPARKCHARTS JAVA Papers page 2 of 4
java.l
Modiers returnType methodName (Parameters) {
method body here }
staticnalsynchronized public static void main(String[] args) { ... }
public private Iterator getIterator(List list) { ... }
private protected public double distance(Point p1, Point p2) { ... } java.lang.
public double 3dDistance RuntimeExc
(Point p1, Point p2, Point p3) { ... }
public protected syncronized void holdThread
new
(int milliseconds) { ... }
private
public class Count {
protected
int number;
public Count(int startNumber) {
publicprivate number = startNumber; }
protected }
Static
object.method (parameters);
class.method (parameters);
object.method1(parameters).method2(parameters) ... ;
this
this
Final Final
this.myMethod();
nal myMethod();
public class Thing {
synchronized int size;
nal int DEFAULT_SIZE = 20;
private Thing(int s) {
changeColor(Color.RED); /* red is a nal eld of size = s;
the Color class */ }
double vol = myPrism.getVolume(height, width, public Thing() {
return
length); new Thing( DEFAULT_SIZE );
}
return
}
void System
Object
Math
java.lang.Object abstract
Boolean
Object
System
extend
super RunnableThrowableObservable
super() String
super.name name
super.myMethod() myMethod() Thread
extends
public class Polygon throws Exception { implements
int sides;
public Polygon(int n) {
sides = n; class Suburban extends Car implements FourWheelDrive,
if (n < 3) throw TooFewSidesException} SixCylinder File
InputStr
public int angleMeasure() {
return 180 * (sides - 2); }
} ObjectIn
classinterface FilterIn
public class Triangle extends Polygon {
nal int SIDES = 3; public interface Runnable { ... }
public interface MouseMotionListener { ... } OutputSt
(className) variable; public Triangle() {
className variable = (className) expression; super(SIDES); }
} ObjectOu
FilterOu
Object
Reader
public interface Runnable {
public void run() {}
Buff
}
StringRe
public interface MouseMotionListener {
Writer
public void mouseDragged(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {}
Buff
} StringWr
This downloadable PDF copyright 2004 by SparkNotes LLC. SPARKCHARTS JAVA Papers page 3 of 4
try/catch/nally
java.lang.Exception try catch
try try/catch
trytry
catch main
catch
Exception try
java.lang.Throwable
ExceptionError
catch
try {
exception generating code here
} catch (Exception1 e1) { exception handling code
java.lang.Exception
here
extendsException
} catch (Exception2 e2) { exception handling
RuntimeException code here
java.lang.RuntimeException } ... public class myException extends Exception { ... }
RuntimeException
w nallycatch
String
nally
String
try {
exception generating code here } public class myException extends Exception {
catch (Exception e) { exception handling code here } String data;
nally { public myException (String someData) {
clean-up code here } super(Exception involving + someData);
data = someData;
}
throws }
toString()Exception
public void ndCar(Car c) throws NoCarException,
Object String
MyException
null String
Vector ArrayList
ArrayList Vector
Vector
ArrayList
Hashtable Hashmap
MouseEvent
ObjectMethodClass Stack
System LinkedList Iterator MouseListener MouseMotionListener
LinkedList MouseEvent
Iterator ActionEvent
Object Date Button CheckBox ActionListener
ActionEvent
Math StrictMath GregorianCalendar KeyEvent
EventObject KeyListenerKeyEvent
t StrictMath java.awt.event WindowEvent
Timer
Boolean Character Double Float Integer WindowListener
StringTokenizer WindowEvent
Strings
System
PatternMatcher
System Random
Pattern
String StringBuffer MatcherPattern
Thread
java.awt
java.awt
rWheelDrive, Graphics
File Strings
InputStream Canvas Graphics2D extends
Graphics JComponent Component
This downloadable PDF copyright 2004 by SparkNotes LLC. SPARKCHARTS JAVA Papers page 4 of 4