Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:47:45+00:00 2026-06-16T01:47:45+00:00

So, according to wikipedia and others, a boolean values should have only 2 states:

  • 0

So, according to wikipedia and others, a boolean values should have only 2 states: 0 or 1; true or false; yes or no; and so on…

OK, correct me if I’m wrong, but, Java Boolean wrapper let developers have 3 states: true, false and null.

Isn’t that wrong?

I know that it could be explained with something like “Boolean is an object” etc etc, but, it would be really great if javac automagically “wrap” null to false, IMHO.

My point is: this behavior let developers do a lot of crap, because they use Boolean instead of a proper object type.

Anyway, what do you think about it? Am I following a wrong line of thinking.. or is it really “wrong”?


EDIT

I know what is null, the differences between boolean and Boolean, etc etc etc (I have 3-year+ exp with java).

My point is about the concept itself, like in Ruby, for example, if I do something like if something, if this something instance is nil, it will be false.

And I’m not saying that Java is crap or something like, I use it everyday.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:47:47+00:00Added an answer on June 16, 2026 at 1:47 am

    null represents the absence of a value, whereas true and false are definite values. It’s the difference between knowing something, either affirmatively or negatively, and not knowing it at all. That’s one way to think of it.

    Technically the reason a Boolean can be null is because it’s an object reference, not a boolean value itself, a confusion that autoboxing might be causing for you. It used to be that you had to manually create Boolean objects to contain boolean values and manually extract the boolean values from Boolean objects. Since Java 5, the compiler will take care of this for you.

    The value of the boolean contained by a Boolean object can either be true or false, but an object variable may not be pointing to an object at all, in which case the value of the reference is null.

    Why is there a difference between boolean and Boolean you might ask? Well, in Java, unlike a lot of newer languages, the primitive types are not classes, and primitives are not objects. When you want to treat them as such, like when you want to pass by reference or call methods on them or put them in collections, you have to box them up in their respective primitive wrapper classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to Wikipedia this syntax looks correct... INSERT INTO dbo.metadata_type (name, publishable) VALUES (Content
According to Wikipedia, x86 is a CISC design, but I also have heard/read that
I have a problem with the rb-trees. according to wikipedia, rb-tree needs to follow
According to Wikipedia , partition-based selection algorithms such as quickselect have runtime of O(n)
According to Wikipedia, the N64 only has 4 MB of RDRAM (8 MB with
According to wikipedia (which could be wrong) When a fork() system call is issued,
According to Wikipedia, the md5 sum of an empty string is d41d8cd98f00b204e9800998ecf8427e I confirmed
According to Wikipedia: IronScheme, an upcoming Scheme implementation, was planning to build upon the
According to this Wikipedia entry on the PNG format , a PNG image file
According to http://en.wikipedia.org/wiki/Producer-consumer_problem I want to simulate P/C problem using semaphore. I am getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.