wood burning stoves 2.0*
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
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: 481
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: 481
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: 481
thanks

you have saved my life

thanks
 
wood burning stoves
 
subject: what is the difference b/w (!= and =!)?