Created
October 17, 2015 11:50
-
-
Save ardianta/953a4b60b6677c6060e7 to your computer and use it in GitHub Desktop.
Demo operator pembanding di java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pertemuan3; | |
public class OperatorPembanding { | |
public static void main(String[] args) { | |
int nilaiA = 12; | |
int nilaiB = 4; | |
boolean hasil; | |
// apakah A lebih besar dari B? | |
hasil = nilaiA > nilaiB; | |
System.out.println(hasil); | |
// apakah A lebih kecil dari B? | |
hasil = nilaiA < nilaiB; | |
System.out.println(hasil); | |
// apakah A lebih besar samadengan B? | |
hasil = nilaiA >= nilaiB; | |
System.out.println(hasil); | |
// apakah A lebih kecil samadengan B? | |
hasil = nilaiA <= nilaiB; | |
System.out.println(hasil); | |
// apakah nilai A sama dengan B? | |
hasil = nilaiA == nilaiB; | |
System.out.println(hasil); | |
// apakah nilai A tidak samadengan B? | |
hasil = nilaiA != nilaiB; | |
System.out.println(hasil); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment