Show Menu
Cheatography

Data Types

byte
8 bits
-27 to 27 - 1
short
16 bits
-215 to 215 - 1
int
32 bits
-231 to 231 - 1
long
64 bits
-263 to 263 - 1
boolean
true \ false
char
16 bit unicode
-215 to 215 - 1
float
32 bit decimal
-231 to 231 - 1
double
64 bit decimal
-263 to 263 - 1

Encaps­ulation

public
user can see
private
hide from user

Swap

int temp = e1;
e1 = e2;
e2 = temp;

While loop

while(condition) {
//codes
}

For Loop Array

string word = "Hello";
for (char c: word.toCharArray()){
     system.out.println()
     ...
}

Class

public class ABCD {
     public A () {
          //codes
     }
     public void B() {
          //codes
     }
}




*public A = default, run automatic
*public void B = need call
 

Commands

\n
new line
\t
tab
\"
"
\'
'
\\
\

Do - While loop

do {
   //codes
} while (condition);

For Loop List

int mylist = {100,200,300,400};
for(int item = 0; item< mylist.length; iterm++){
  //codes
}

for(int item mylist) {
  //codes
}

Abbrev­iation

JVM
JAVA Virtual Machine
JRE
JAVA Runtime Enviro­nment
JDK
JAVA Develo­pment Kit
bytecode
interm­ediate level long
compiler
JAVA -> Bytecode
Java Runtime
bytecode -> machine
native compiler
directly to machine

Array

int[] mylist = new int[2]
mylist[0] = 100;
mylist[1] = 200;

int[] mylist = {100, 200}
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Selenium WebDriver Cheat Sheet Cheat Sheet
          Cypressio Cheat Sheet
          ISTQB Test Automation Engineering Cheat Sheet

          More Cheat Sheets by pca221