| | |
Inverting value of boolean variable?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 3,842
Reputation:
Solved Threads: 503
•
•
•
•
Hi guys,
I am using boolean variables as flags in a program and i want to be able to invert the value.
for example if the current value is true, then it must be changed to false; doesn't matter if i don't know what the current value is.
Java Syntax (Toggle Plain Text)
boolean a = true; System.out.println (Boolean.toString(a)); // true a = !a; System.out.println (Boolean.toString(a)); // false
![]() |
Similar Threads
- Return Boolean to main (Java)
- Retrieving Form Variable (Visual Basic 4 / 5 / 6)
- Accessing boolean Values of another values in one class. (Java)
- problems with variable accumulation (VB.NET)
- Finding Prime numbers without using Boolean (C++)
- how to pass class variable to another class (Java)
- What is the size of a boolean variable (Java)
- Any Boolean Expression to Sum of Minterms (C++)
Other Threads in the Java Forum
- Previous Thread: Penny Pitch Game
- Next Thread: Please help me with the program code
Views: 646 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android animated api apple applet application arguments array arrays automation binary blackberry block bluetooth chat class classes client code component database developmenthelp draw eclipse encode error event exception file fractal game gameprogramming givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie notdisplaying number object online oracle print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing system template test textfields threads time title transfer tree tutorial-sample update windows working






