This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what is the difference b/w (!= and =!)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what is the difference b/w (!= and =!)?" Watch "what is the difference b/w (!= and =!)?" New topic
Author

what is the difference b/w (!= and =!)?

Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
what is the difference b/w (!= and =!)?

please tell me with example
Akshay Kiran
Ranch Hand

Joined: Aug 18, 2005
Posts: 220
"!=" is the "not equal to" test operator
var_x != var_y just tests if the var_x is not equal to var_y
If var_x = 3; var_y = 4;
then the test returns "true"

"=!" is the assignment operator compounded with a "!" not operator
bool_x =! bool_y assigns to bool_x true if bool_y is false and vice versa

for applicatability of the "!" operator, please refer to the java language specification.


"It's not enough that we do our best; sometimes we have to do<br />what's required."<br /> <br />-- Sir Winston Churchill
Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
thanks a lot
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Karu, please be sure that you realise that "=!" is not a Java operator, whereas "!=" is a single Java operator. Instead of using "=!" it is better to put spaces between the "=" and the "!". That is, like this: boolean b = !true; in which case the boolean variable b gets the value false.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Karu Raj
Ranch Hand

Joined: Aug 31, 2005
Posts: 479
thanks

you have saved my life

thanks
 
wood burning stoves
 
subject: what is the difference b/w (!= and =!)?
 
Similar Threads
Arrays
Arrays
Abstract Classes & Interfaces
difference b/w page and pageContext
Difference b/w "session.putValue" and session.setAttribute"?