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];
nullnull
booleantrue false
char'a'
byte short int long32 2147483648L
float double3.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) statementdo 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}