A quick reference sheet to java's beginner instructions
|
int
|
2, 5, -3, -10, 22
|
|
float
|
2.5, 3.2, 10.15, -2010, 0, 0.01
|
|
String
|
"Nom", "Client", "ModDePasse", "-5.2"
|
|
boolean
|
true, false
|
|
DATATYPE VARIABLE;
|
|
DATATYPE VARIABLE = VALEUR;
|
|
DATATYPE VARIABLE, VARIABLE2;
|
|
DATATYPE VARIABLE = VALEUR, VARIABLE2 = VALEUR2;
|
|
if
|
if(CONDITION) {}
|
|
if else
|
if(CONDITION) {} else {}
|
|
if else if
|
if(CONDITION) {} else if(CONDITION2) {}
|
|
System.out.println("Message");
|
|
System.out.println(Variable);
|
|
import java.util.Scanner;
|
Scanner NOM = new Scanner(System.in);
|
|
int variable = scanner.nextInt();
|
float variable = scanner.nextFloat();
|
|
String variable = scanner.nextLine();
|
|
|
while
|
while(CONDITION) { }
|
|
for
|
for(int i = 0; i < max; i++) { }
|
|
do while
|
do {} while(CONDITION);
|
|
TYPE nom[];
|
nom = new TYPE[TAILLE];
|
|
TYPE nom[] = new TYPE[TAILLE];
|
TYPE nom = { valeur1, valeur2, valeur3 };
|
int tableau[] = new int[5];
for(int i = 0; i < 5; i++){
tableau[i] = valeur;
// possible:
tableau[i] = scanner.nextInt();
}
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.