What is the difference between the = symbol and == symbol?
What is the difference between the = symbol and == symbol?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
One of the most common mistake that a programmer can make is to confuse the equal sign (=) with a double equal signs (==).
When we wish to assign a value to a variable or member, we use the equals sign (=).
For example:
x = 1 + 4; // assignment operation
When we wish to make a comparison, such as in an if statement, we use the double equals sign (==).
For example:
if ( x == y ) { System.out.println ("Match found!"); } // comparison