Rabu, 31 Oktober 2012

java-bolean

public class relasi
{
public static void main(String[] args) {
//beberapa nilai
int liverpool = 37;
int juventus = 42;
int madrid = 42;
System.out.println("Nilai variabel...");
System.out.println(" liverpool = " + liverpool);
System.out.println(" juventus = " + juventus);
System.out.println(" madrid = " + madrid);
//lebih besar dari
System.out.println("Lebih besar dari...");
System.out.println(" liverpool > juventus = " + (liverpool > juventus)); //false
System.out.println(" juventus > liverpool = " + (juventus > liverpool)); //true
System.out.println(" madrid > juventus = " + (madrid > juventus)); //false
//lebih besar atau sama dengan
System.out.println("Lebih besar dari atau sama dengan...");
System.out.println(" liverpool >= juventus = " + (liverpool >= juventus)); //false
System.out.println(" juventus >= liverpool = " + (juventus >= liverpool)); //true
System.out.println(" madrid >= juventus = " + (madrid >= juventus)); //true
//lebih kecil dari
System.out.println("Lebih kecil dari...");
System.out.println(" liverpool < juventus = " + (liverpool < juventus)); //true
System.out.println(" juventus < liverpool = " + (juventus < liverpool)); //false
System.out.println(" madrid < juventus = " + (madrid < juventus)); //false
//lebih kecil atau sama dengan
System.out.println("Lebih kecil dari atau sama dengan...");
System.out.println(" liverpool <= juventus = " + (liverpool <= juventus)); //true
System.out.println(" juventus <= liverpool = " + (juventus <= liverpool)); //false
System.out.println(" madrid <= juventus = " + (madrid <= juventus)); //true
//sama dengan
System.out.println("Sama dengan...");
System.out.println(" i == j = " + (i == j)); //false
System.out.println(" k == j = " + (k == j)); //true
//tidak sama dengan
System.out.println("Tidak sama dengan...");
System.out.println(" i != j = " + (i != j)); //true
System.out.println(" k != j = " + (k != j)); //false
}}

Tidak ada komentar:

Posting Komentar