Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Karu Raj
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference b/w (!= and =!)?

please tell me with example
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"!=" 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.
 
Karu Raj
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Karu Raj
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks

you have saved my life

thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic