IF ELSE
if (var1=var2) {
statement1;
} else {
statement2;
}
atau
var1==var2 ? statement1 : statement2;
atau
if (condition) {
statement1;
} else if (condition){
statement2;
} else {
statement3;
}
FOR
for (initial; boolean expression; expression){
statement;
}
contoh :
for(int i=0;i<10;i++){
jumlah_amaun += cachedData.getRow(i).getDouble("amaun_resit");
}
SWITCH
switch (elemen no) {
case condition1:
statement1;
break;
case condition2:
statement2;
break;
default:
statement3;
}
No comments:
Post a Comment