Wednesday 10 June 2015

Equality And Relational Operators 1

public class ComparisonDemo {
        public static void main(String[] args) {
                int A = 0;
                int B = 0;

                // Test if A and B are equal.
                if(A == B)
                        System.out.println("A is equal to B.");

                ++B; // Increment B.

                // Test if A and B are not equal.
                if(A != B)
                        System.out.println("A and B are not equal.");
        }
}

No comments:

Post a Comment

Translate