Operator pembanding itu operator yang hasil nya adalah nilai dengan tipe data
boolean (true atau false)
Ada beberapa operator pembanding, diantarnya :
/*
* Copyright (c) 2012 @khannedy and/or its affiliates. All rights reserved.
* @khannedy PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package khannedy.pakarjava.javadasar;
/**
*
* @author Eko Kurniawan Khannedy
*/
public class OperatorPembanding {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int a = 10;
int b = 15;
boolean hasilSama = (a == b);
System.out.println(hasilSama);
boolean hasilTidak = (a != b);
System.out.println(hasilTidak);
boolean hasilLebihSama = (a >= b);
System.out.println(hasilLebihSama);
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39