- Details
- Written by Nam Ha Minh
- Last Updated on 18 August 2019 | Print Email
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:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on
Facebook and watch
his Java videos on YouTube.