The boolean keyword is used to declare a variable as a boolean type, which represents only either true or false. For example:

boolean isAlive;

The boolean keyword can be used to declared return type of a method as well:

public boolean hasChildren() {
    return true;
}

See all keywords in Java.

 

Related Topics:

 

Other Recommended Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.



Add comment

   


Comments 

#1Matthew2020-05-12 11:04
Greetings Nam,

Thank you so much for providing clear Java illustrations and examples throughout your website. For example, your keyword list is the perfect reference tool as I continue through my Java Masterclass.
Quote