> > Operator Relasi

Operator Relasi


public class OperatorRelasi {
public static void main (String[] args){

int a = 10;
int b = 10;
double x = 30.45;
double y = 25.25;

System.out.println("Lebih Kecil Dari");
System.out.println("a < b = "+(a<b)); //false
System.out.println("x < y = "+(x<y)); //false
System.out.println();
System.out.println("Lebih Besar Dari");
System.out.println("a > b = "+(a>b)); //false
System.out.println("x > y = "+(x>y)); //true
System.out.println();
System.out.println("Lebih Besar Atau Sama Dengan");
System.out.println("a >= b = "+(a>=b)); //true
System.out.println("x >= y = "+(x>=y)); //false
System.out.println();
System.out.println("Lebih Kecil Atau Sama Dengan");
System.out.println("a <= b = "+(a<=b)); //true
System.out.println("x <= y = "+(x<=y)); //false
System.out.println();
System.out.println("Sama Dengan");
System.out.println("a == b = "+(a==b)); //true
System.out.println("x == y = "+(x==y)); //false
System.out.println();
System.out.println("Tidak Sama Dengan");
System.out.println("a != b = "+(a!=b)); //false
System.out.println("x != y = "+(x!=y)); //true
}
}

Leave a Reply

Powered by Blogger.