Results 1 to 7 of 7
  1. #1
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Why would you use a boolean?

    like, sometimes people do boolean and then setVisible(false).
    why??????? why would you add it if you're not going to display it.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,344
    Blog Entries
    7
    Rep Power
    20

    Default Re: Why would you use a boolean?

    I've never 'done a boolean' ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    superhaNds is offline Senior Member
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    262
    Rep Power
    2

    Default Re: Why would you use a boolean?

    Quote Originally Posted by MR bruto View Post
    like, sometimes people do boolean and then setVisible(false).
    why??????? why would you add it if you're not going to display it.
    what does "do boolean" mean?

  4. #4
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: Why would you use a boolean?

    lol sorry. but why do people use it

  5. #5
    superhaNds is offline Senior Member
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    262
    Rep Power
    2

    Default Re: Why would you use a boolean?

    Why people use boolean variables? It is a primitive data type. Or why people use setVisible(false) ?

  6. #6
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: Why would you use a boolean?

    in the example you use i assume you referring to Swing and JFrames etc, since JFrames are not visible by default that setVisible(false); doesn't really do anything. I like to include it anyways as i see it as good practice and its pretty easy to de bug your code if you include things like that in your code.

    example:

    "Hmm my JFrame is not displayed when i created a new instance, let me check why" .... "Ah i see ive set the visibility to false" - Extreme example but helps me personally.

  7. #7
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: Why would you use a boolean?

    thanks a lot, this cleared up a good part :)

Similar Threads

  1. Boolean
    By must0995 in forum New To Java
    Replies: 1
    Last Post: 04-13-2012, 10:18 PM
  2. Boolean
    By Twixmaster123 in forum New To Java
    Replies: 1
    Last Post: 04-13-2012, 08:20 AM
  3. Replies: 3
    Last Post: 09-13-2011, 12:01 AM
  4. boolean error help when no boolean is given
    By drewtrcy in forum New To Java
    Replies: 18
    Last Post: 05-05-2011, 09:04 AM
  5. boolean even or odd?
    By shazakala in forum New To Java
    Replies: 3
    Last Post: 04-17-2011, 08:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •