Selasa, 28 Februari 2012

SHINee - Hello Baby







IF ELSE IF ( NETBEANS)


public static void main (String[] args){
int uhb1 =50;
if (uhb1 >= 80){
System.out.println("nilai uhb-1= "+uhb1);
System.out.print("keterangan= ");
System.out.println("tuntas");
}
else if (uhb1 <=55 ){
System.out.println("nilai uhb-1= "+uhb1);
System.out.print("keterangan= ");
System.out.println("pindah sekolah");
}
else{
System.out.println("nilai uhb-1= "+uhb1);
System.out.print("keterangan= ");
System.out.println("remedial");
}
}
}

IF ELSE


public static void main (String[] args){

int grade =68;
if(grade>60){
System.out.println("selamat");
System.out.println("kamu lulus");
}
else{
System.out.println("maaf,kamu tidak lulus");
}
}
}

latihan FOR


public static void main(String[]args){
    char i='A';
     for(i='A'; i<='I';i++){
      System.out.println(" "+i);
      i++;
        }
}
}

HASIL:
A
 C
 E
 G
 I

contoh FOR


public static void main(String[]args){
    int i;
    for( i=0; i<10; i++){
        System.out.print(i);
    }
}
}


HASIL: 0123456789

contoh DO WHILE


public static void main(String[]args){
    int x = 0;
    do
    {
        System.out.println(x);
        x++;
        }while(x<10);
}
}


HASIL: 0
1
2
3
4
5
6
7
8
9

contoh WHILE


public static void main(String[]args){
    int i = 4;
    while (i>0){
        System.out.print(i);
        i--;
    }
}
}

Hasilnya: 4321

SHINee Etude House