JAVA Cheat Sheet
by pca221 via cheatography.com/25815/cs/8969/
Data Types Commands
byte 8 bits -27 to 2 7 - 1 \n new line
short 16 bits -215 to 2 15 - 1 \t tab
int 32 bits -231 to 2 31 - 1 \" "
long 64 bits -263 to 2 63 - 1 \' '
\\ \
boolean true \ false
char 16 bit unicode -215 to 2 15 - 1
Do - While loop
float 32 bit decimal -231 to 2 31 - 1
do {
double 64 bit decimal -263 to 2 63 - 1
//codes
} while (condition);
Encapsulation
public user can see For Loop List
private hide from user
int mylist = {100,200,300,400};
for(int item = 0; item< mylist.length; iterm++){
Swap
//codes
int temp = e1; }
e1 = e2; for(int item mylist) {
e2 = temp; //codes
}
While loop
while(condition) { Abbreviation
//codes JVM JAVA Virtual Machine
} JRE JAVA Runtime Environment
JDK JAVA Development Kit
For Loop Array
bytecode intermediate level long
string word = "Hello";
compiler JAVA -> Bytecode
for (char c: word.toCharArray()){
Java Runtime bytecode -> machine
system.out.println()
native compiler directly to machine
...
}
Array
Class int[] mylist = new int[2]
mylist[0] = 100;
public class ABCD {
mylist[1] = 200;
public A () {
int[] mylist = {100, 200}
//codes
}
public void B() {
//codes
}
}
*public A = default, run automatic
*public void B = need call
By pca221 Published 9th September, 2016. Sponsored by Readability-Score.com
cheatography.com/pca221/ Last updated 9th September, 2016. Measure your website readability!
Page 1 of 1. https://readability-score.com