The Department of Computer Science & Engineering |
// rest of line
/* multiline comment */
/** documentation comment */
javadoc -d docfile -author sourcefiles
public class name
{ [class_variable_declarations]
public static void main{String[] args) {statements}
[methods]
}
{public | private} [static] {type |
void} name(arg, ..., arg) {statements}
{public |
private}
static type name
[= expression];
null
null
boolean
true false
char
'a'
byte short int long
32 2147483648L
float double
3.14E+5F 3.14E+5
String
"A string"
type[[length]]
{1, 2, 3}
+ - * / %
+
== != < <= > >=
string.equals(
string)
! && ||
(condition ?
then_expression :
else_expression)
System.out.print[ln](string)
[label:]{statements}
break [label];
return expression;
System.exit(0);
if (condition)
statement [else statement]
while (condition) statement
do statement
while (condition);
for (initialization; termination; update) statement
switch (integer_or_char_expression) {
case integer_or_char_literal: statements break;
...
case integer_or_char_literal: statements break;
default: statements}