in this article, you will learn how to compare values in Java through an example.


package javaapplication;

/**
 *
 * @author Rathorji
 */
public class JavaApplication {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        int age = 18;
        if ( age >= 18) {
            System.out.println("You are eligible for voting!");
        }

    }

}


output:

run:
You are eligible for voting!