10 Replies - 1476 Views - Last Post: 24 December 2009 - 07:26 PM

#1 thecode222   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 62
  • Joined: 11-November 09

What is a boolean

Posted 23 November 2009 - 07:41 AM

It gives me a question like this...
boolean eBoola = true;
System.out.println(!eBoola);


I don't really understand it so if you can dumd it down a little.
And thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: What is a boolean

#2 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3213
  • View blog
  • Posts: 19,241
  • Joined: 14-September 07

Re: What is a boolean

Posted 23 November 2009 - 07:47 AM

What exactly is the question?

It creates a boolean set to true and prints out NOT boolean which is !true = false.
Was This Post Helpful? 0
  • +
  • -

#3 thecode222   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 62
  • Joined: 11-November 09

Re: What is a boolean

Posted 23 November 2009 - 07:57 AM

What is output by the code to the right?
Was This Post Helpful? 0
  • +
  • -

#4 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3213
  • View blog
  • Posts: 19,241
  • Joined: 14-September 07

Re: What is a boolean

Posted 23 November 2009 - 07:59 AM

Did you not read what I wrote?
Was This Post Helpful? 0
  • +
  • -

#5 thecode222   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 62
  • Joined: 11-November 09

Re: What is a boolean

Posted 23 November 2009 - 08:03 AM

right i did you said what is the question
Was This Post Helpful? 0
  • +
  • -

#6 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3213
  • View blog
  • Posts: 19,241
  • Joined: 14-September 07

Re: What is a boolean

Posted 23 November 2009 - 08:05 AM

KYA said:

It creates a boolean set to true and prints out NOT boolean which is !true = false.

Was This Post Helpful? 0
  • +
  • -

#7 thecode222   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 62
  • Joined: 11-November 09

Re: What is a boolean

Posted 23 November 2009 - 08:09 AM

O forgive me. I am sorry. I didn't read it right.
So it is false for (!)?
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 16479
  • View blog
  • Posts: 65,313
  • Joined: 12-June 08

Re: What is a boolean

Posted 23 November 2009 - 10:14 AM

The "!" gets the inverse (or opposite) of the boolean value after it.

If the boolean value was true, putting a ! in front makes it false.
If the boolean value was false, putting a ! in front makes it true.

It's like saying 'not this boolean value'..
Was This Post Helpful? 0
  • +
  • -

#9 pablo9891   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 19-December 09

Re: What is a boolean

Posted 23 December 2009 - 09:41 PM

Perhaps you don't knwo wxactly what a boolean is. A boolean is a variable which could possibly has two kind of values: True or False, most of the times you use it for the conditions statements. There are differents conectors for the booleans, like AND, OR, NOT, which compares the values from the vaiables and decide what t do.
Was This Post Helpful? 0
  • +
  • -

#10 Tom9729   User is offline

  • Segmentation fault
  • member icon

Reputation: 181
  • View blog
  • Posts: 2,642
  • Joined: 30-December 07

Re: What is a boolean

Posted 24 December 2009 - 07:08 PM

What exactly was preventing you from just putting that in a Java program and running it to determine the result?
Was This Post Helpful? 0
  • +
  • -

#11 Aphex19   User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 619
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: What is a boolean

Posted 24 December 2009 - 07:26 PM

Here's an example in C. Lets say you create a boolean variable (true or false).

bool isThisTrue = false;


This code would change the state of the boolean variable (ie from false to true and visa versa).

isThisTrue = !isThisTrue;


In other words it is saying

isThisTrue = not current value of isThisTrue


Sorry if thats a bit random but I thought it might be a good example.

This post has been edited by Aphex19: 24 December 2009 - 07:27 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1