Java Programming - Language Fundamentals - Discussion
Discussion Forum : Language Fundamentals - General Questions (Q.No. 11)
11.
Which one is a valid declaration of a boolean?
Answer: Option
Explanation:
A boolean can only be assigned the literal true or false.
Discussion:
15 comments Page 2 of 2.
Amaziane said:
1 decade ago
For the option D we can initialize a boolean with this method.
Boolean b = Boolean.FALSE;
Boolean b = Boolean.TRUE;
Boolean b = Boolean.FALSE;
Boolean b = Boolean.TRUE;
Vinita said:
9 years ago
Why A is not Correct? Answer me clearly.
Neeraja said:
9 years ago
Option A is not correct because in boolean data type it's consists only true or false statement.
Option B also not correct because false is declared within single quotes like string.
So, Option C is right.
Option B also not correct because false is declared within single quotes like string.
So, Option C is right.
Tamisevi said:
8 years ago
Why b is not correct?
Bhanu said:
8 years ago
Either boolean should be true or false nor (0, 1) then why not option A is correct?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers