Explain the Boolean data type with an Example.
Advertisements
प्रश्न
Explain the Boolean data type with an Example.
स्पष्ट कीजिए
Advertisements
उत्तर
The boolean data type is a primitive data type in Java that is used to store logical values. It can store only two values: true or false. It is mainly used in conditional statements, comparisons and decision-making operations.
Example:
boolean isPassed = true;
In the above example, boolean specifies the data type, isPassed is the variable name, and true is the logical value assigned to the variable.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
