//
|
Keyword: start of one-line comment |
/* |
Keyword: start of multi-line comment
(ends with */) |
= |
Keyword: becomes (assignment symbol) |
== != |
Is equal to, is not equal to |
< <= > >= |
Compare |
+ |
Add numbers or join strings |
- |
Subtract or negate |
* |
Multiply (must always be explicit) |
/ |
Divide (integer or floating division, depending on types of arguments) |
% |
Remainder on integer division |
&& || ! |
And, or, not (boolean operators) |
() |
Notation: bracketing and calling and casting |
[] |
Notation: used for arrays (declarations and indexing) |
{} |
Notation: blocks and compound initialisers |
BigInteger |
Class of unlimited integers (in java.math) |
boolean |
Type of booleans (see true,
false) |
char |
Type of characters (unicode; 16 bits each) |
Character |
Class providing operations on chars |
class |
Keyword: define a new class |
double |
Type of floating point numbers (double precision) |
Double |
Class providing operations on floating point numbers |
false |
Constant (of type boolean) |
floor |
Round a floating point number down to the integer below with Math.floor(x) |
if... |
Keyword: testing with if (b) c; or if (b) c; else d; |
int |
Type of 32-bit integers (up to about 9 or 10 decimal digits) |
Integer |
Class providing operations on ints |
isDigit |
Test whether a character is a digit with Character.isDigit(c) |
isLetter |
Test whether a character is a letter with Character.isLetter(c) |
isLowerCase |
Test whether a character is a lower case letter with Character.isLowerCase(c) |
isUpperCase |
Test whether a character is an upper case letter with Character.isUpperCase(c) |
isWhitespace |
Test whether a character is a space, tab, newline etc with Character.isWhitespace(c) |
length |
Find the length of an array with a.length or a string with s.length() |
Math |
Class providing operations on numbers |
max |
Find the maximum of two ints or doubles with Math.max(x,y) |
min |
Find the minimum of two ints or doubles with Math.min(x,y) |
Object |
Class which all other classes extend |
parseDouble |
Convert a string into a double with Double.parseDouble(s) |
parseInt |
Convert a string into an int with Integer.parseInt(s) |
pow |
Math.pow(x,y) takes x to the power y (floating point) |
print |
Write out a string with System.out.print(s) |
println |
Write out a string, followed by a newline, with System.out.println(s) |
round |
Round a floating point number to the nearest integer with Math.round(x) |
String |
Class of strings (protected, read-only, char arrays) |
StringBuffer |
Class of manipulable strings (protected char arrays) |
substring |
Extract a substring from the middle of a string with s.substring(i,j) |
System |
Class providing standard input, output streams etc |
toLower |
Convert a character to lower case with Character.toLower(c) |
toString |
Convert an object into a string with x.toString() |
toUpper |
Convert a character to upper case with Character.toUpper(c) |
true |
Constant (of type boolean) |