Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

Bool vs boolean - What's the difference?

Asked by Andrew Jenkins Oct 10, 2022 1.7K views 1 answer
Share

About this question

bool vs Boolean to use an established shorter name for primitive type? or integer vs Integer to keep type names consistent?

I think C++ had decided to use bool quite a bit earlier than Java decided to use boolean, and maybe also some (non-standard at the time?) C extensions too, so there would have been historical precedence for bool. I've noticed I often instinctively try to use bool at first (good thing modern editors immediately spot this without extra compilation rounds), so it'd be nice to know the rationale behind the current state of affairs.

If someone remembers (a part of) the story,Java has

int and Integer

boolean and Boolean

This seems a bit inconsistent, why not either

 or can even find and link to relevant historical discussion on the net, that would be great.

Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.