Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Equality and Relational Operators

                         

Whenever we need to compare the results of two expressions or operands in a program then the equality and relational operators are used to know whether an operand is equal, not equal, greater than, less than to another operand. There are different types of equality and relational operators mentioned in a table given below:

 

 

 

 

Symbol Name of the Operator Example Operation
 = = Equal to  a = = b  a is equal to b
 != Not equal to  a ! = b  a is not equal to b
 >   Greater than  a > b  a is greater than b
 <  Less than  a < b  a is less than b
 >=  Greater than or equal to  a > = b  a is greater than or equal to b
 <=   Less than or equal to  a > = b  a is less than or equal to b

The Equality operator "= =" differs from an assignment operator "=" i.e. the equality operator is used to determine whether one operand is equal to another operand or not while the assignment operator is used to assign a value to a variable.
All these operators are often used in the control structures such as if, do, while with the conditional operators to make decisional expressions.  

Lets have an example implementing these operators:

class EquityOperator {

     public static void main(String[] args){
          int x = 5;
          int y = 10;
          if(x == y)
        System.out.println("value of x is equal to the value of y");
          if(x != y) 

        System.out.println("value of x is not equal to the value of y");
          if(x > y) 

        System.out.println("value of x is greater then the value of y");
          if(x < y) 

        System.out.println("value of x is less then the value of y");
          if(x >= y)

        System.out.println("value of x is greater then or equal to the value of y");
      if(x <= y) 
        System.out.println("value of x is less then or equal to the value of y");
     }
}

 Output of the Program: 

C:\nisha>javac EquityOperator.java

C:\nisha>java EquityOperator
value of x is not equal to the value of y
value of x is less then the value of y
value of x is less then or equal to the value of y

Download this Program

 

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
PHP Date and .....:/pw
javascript code in jsp
howtosortuserinputnumb
Removing a Row from a
Login page source code
jar file
write a program to cre
reading image from htm
jar coding
Photoshop Text Effects
PHP Date and .../tools
how to get selected ce
save folder contents
getfilename
multiple radio tags st
struts validation
jsf radiobutton and da
PHP Date and .....:/pw
oops
Hibernate Annotations
swing animation
install hibernate on
program saving files u
how to execut the .bat
PHP Date and .../tools
depth first search in
how can i convert stri
java functions
jsp bean get property
html div tags
Image with mouse drag
Flash Navigation Drop
Arrays
XML parsing into javas
example of JFileChoos
creating graph through
display image in java
type Conversion of Str
how to retrieve databa
session handling in st
simple servlet program
CSV
program using iserror
@OneToMany in persiste
multiple radiobuttons
how can i add interger
swing package
ASP Ad Management CJ s
Combattons la programm
File Validation code
add the ArrayList to
hashset\
Jini's relevance emerg
breadcrumbs in jsp
how to pass same varia
string array add eleme
ODBC 2.5 and ODBC 3.0.
Date in JSP
create file jsp
Java in Flex
depth first search of
ASP.NET .NET Inside AS
xmlwithjsp
jQuery to Select Multi
export access database
access mysql through c
struts.mapper.class
Ã?Æ?Ã?Â¥Ã?â??Ã?­?Ã?Æ?
coding of windows medi
actionfrom validation
smallest palindrome ma
JFileChooser showOpen
jsp MENU SELECT MAKES
removing rows from Jta
create table with bina
prime numbers between
new function
jboss portal
Photoshop Drawing Drag
authorisation and auth
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.