Documente Academic
Documente Profesional
Documente Cultură
Author: Jialong He
Jialong_he@bigfoot.com
http://www.bigfoot.com/~jialong_he
+, -, *, /
%, ++, --
Relational Operators
==, !=, >, <,
>=, <=
-128..127
short
16
-32,768..32,767
Logical Operators
&, |, !, ^, ||, &&,
int
32
-2,147,483,648.. 2,147,483,647
Bitwise Operators
long
64
-9,223,372,036,854,775,808..
9,223,372,036,854,775,807
&, |, ~, ^,
>>, >>>, <<
Comments
float
32
3.4e-0.38.. 3.4e+0.38
double
64
1.7e-308.. 1.7e+308
char
16
Boolean
true, false
// rest of line
/* multiline comment */
/** documentation comment */
decare a variable:
type identifier [= value];
Arrays
int array_name[ ];
array_name=new int[100 ];
javac nameOfFile.java
java nameOfFile
multidimensional array.
null
Class
{public|final|abstract} class name
{ [class_variable_declarations]
public static void main{String[] args) {statements}
[methods]
}
this, super
Methods
{public | private } [static] {type | void} name(arg, ..., arg ) {statements}
Variable
Flow Control
if (Boolean-expression) statement1; [ else statement2; ]
while loop
[initialization]
while (termination-clause) {
body;
[iteration;]
}
do while loop
do {
body;
[iteration;]
} while (termination-clause);
for loop
for (initialization; termination-clause; iteration)
body;
Program Structure
class className {
public static void main (String args[ ]) {
statements;
}
method definition1
method definitionN
}
Arithmetic Operators
Key words
abstract
boolean
break
byte
byvalue
case
cast
catch
char
class
const
continue
default
do
double
else
extends
false
final
finally
float
for
future
generic
goto
if
implements
import
inner
instanceof
int
interface
long
native
new
null
operator
outer
package
private
protected public
rest
return
short
static
super
switch
synchronized this
throw
throws
transient
true
var
void
volatile
while
try
Java packages
java.applet
java.awt
java.awt.color
java.awt.event
java.awt.font
java.awt.geom
java.awt.im
java.awt.im.spi
java.awt.image
java.beans
Contains classes related to developing beans -components based on the JavaBeansTM architecture.
java.lang
java.lang.ref
java.lang.reflect
java.math
java.net
java.nio
java.nio.channels
java.nio.charset.spi
java.rmi
java.rmi.activation
java.rmi.dgc
java.rmi.registry
java.rmi.server
java.security
java.security.acl
java.security.cert
java.security.spec
java.sql
javax.imageio.strea
m
javax.naming
java.text
java.util
javax.naming.ldap
javax.naming.spi
javax.net
javax.net.ssl
javax.print
java.util.jar
TM
java.util.logging
java.util.prefs
java.util.regex
java.util.zip
javax.crypto
javax.imageio
javax.rmi
javax.rmi.CORBA
javax.security.auth
javax.sound.midi
javax.xml.parsers
javax.sql
javax.swing
javax.swing.event
javax.swing.text
javax.swing.tree
javax.swing.undo
javax.transaction