Jul 04 2009

The Equality and Relational Operators

Category: Javaadmin @ 1:26 pm
==	equal to
!=	not equal to
>	greater than
>=	greater than or equal to
<	less than
<=	less than or equal to
public class ComparisonDemo
{
	public static void main (String[] args)
	{
		int x = 3;
		int y = 5;
		if (x==y)
			System.out.println("equal to");
		if (x!=y)
			System.out.println("not equal to");
		if (x&gt;y)
			System.out.println("greater than");
		if (x&gt;=y)
			System.out.println("greater than or equal to");
		if (x&lt;=y)
			System.out.println("less than or equal to");
	}
 
}

Out put
not equal to
less than
less than or equal to

Tags: , ,