You are on page 1of 1

USEFUL JAVA FACTS

Comparison operators case 'value': {statement block;


==, <, >, !=, <=, >= [break;]}
..
Arithmetic operators [default: {statement block}]
+, -, *, /, %, ++, -- }

Logical operators String methods


&&, ||, ! int length()
char charAt(int index)
Native data types int compareTo(String
char, byte, short, int, long, anotherString)
float, double, boolean String endsWith(String suffix)
int indexOf(String str)
Selection operator int indexOf(String str, int
. fromIndex)

Assignment operators Character methods


=, +=, *=, -=, /+, %= boolean isDigit()
boolean isLetter()
Casting
(type) var

Scanner (input) methods


int nextInt()
String next()

Print (output) methods


System.out.print()
System.out.println()

Math methods
double Math.random()

Decision statements
if(boolean statement){
statement block
}
[else{
statement block
}]

switch(intDataType){

You might also like