Show Menu
Cheatography

JAVA Statment

If Statem­ent

if ( expre­ssion ) {
 ­ ­st­ate­ments 
} else if ( expre­ssion ) {
 ­ ­st­ate­ments
} else {
 ­ ­st­ate­ments
}

While Loop

while ( expre­ssion ) {
 ­ ­st­ate­ments
}

Do-While Loop
do {
 ­ ­st­ate­ments
} while ( expre­ssion );

For Loop

for ( int i = 0; i < max; ++i) {
 ­ ­st­ate­ments
}


Switch Statem­ent
switch ( expre­ssion ) {
 ­ case value:
 ­ ­ ­ ­st­ate­ments
 ­ ­ ­ ­break;
 ­ case value2:
 ­ ­ ­ ­st­ate­ments
 ­ ­ ­ ­break;
 ­ ­def­ault:
 ­ ­ ­ ­st­ate­ments
}
Do....while
int count=0;
do{
         System.out.print(count + " ");
         count ++ ;
}while (count < 10);

Ans 0 1 2 3 4 5 6 7 8 9
 

Numbers

byte
8 bits

short
16 bits

int
32 bits

long
64 bits

boolean
( no bit just true/ false)

char
16 bit unicode

float
32 bit decimal

double
64 bit decimal

Command

/n = new line
/t = tap 
/" = "
/* = multiple

make class

Click src > main > new > Java class (then type the code)


public class Hello
 

Arrays / List

int[] ex1 = new int [3];
ex1[0]= 1;
ex2[1]= 2;
ex3[2]= 3;

String

String name = "bacon"
or
String name = 'Bacon'

Vocab

Java
high level progra­­mming language that is readable by human called JVM ( Java Virtual Machine ).
Compiler
translater the program into machine language that can be executed directly on the computer.
Executed
Runing
JVM
another run program of Java. It referred to Java runtime.
JDK (Java Develo­­pment Kit)
contains a complete class library of utilities that help you accomplish most common tasks.
Java runtime
a program that execute compiled Java byte codes.
Java bytecodes
he java complier translate your java program to be an interm­­ediate level, which can be executed only by JVM.
   
 

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 Sonnylnw MUIDS