Saturday 1 February 2014

1. Chapter1 - Installation and setup
Java development kit = compiler, virtual machine, and codes
package = nothing but folder

Chapter2 Notes
comment
- multiline: /*
- single line: //

printing a text
System.out.println("aloha");

concantenator = +
examples:
x = 10
System.out.println("aloha" + x);

mod: %
example: 5 % 2

IF
int x = 20;
int y = 20;
if (x < y){
    System.out.println("x is less then y");
}
if (x == y){
    System.out.println("x is equal to Y");
}
if (x > y){
    System.out.println("x is bigger then y");
}

shorten that if

int x = 20;
int y = 20;
if (x < y) {
    System.out.println("x is less then y");
}
else if (x == y)
shorten again:

Symbol:
x ++ itu sama dengan x = x+1 sama dengan x+=1

Switch-case
Contoh: pemilihan menu nasi goreng berdasarkan jenis hari.
nasigoreng = hari

No comments:

Post a Comment