Java Programming - Language Fundamentals - Discussion

Discussion Forum : Language Fundamentals - General Questions (Q.No. 11)
11.
Which one is a valid declaration of a boolean?
boolean b1 = 0;
boolean b2 = 'false';
boolean b3 = false;
boolean b4 = Boolean.false();
boolean b5 = no;
Answer: Option
Explanation:
A boolean can only be assigned the literal true or false.
Discussion:
15 comments Page 2 of 2.

Kirti said:   1 decade ago
Option D is not correct because Boolean is not correct it must be Boolean.

Akanksha said:   1 decade ago
Option B is have single quotes which is for a string so its wrong.
Option D is compilation error.
Option E is also compilation error as no is not any keyword.

Sweety said:   1 decade ago
Boolean always returns true or false. So option A can't be !

Saurav said:   1 decade ago
Why is option A not correct?

Vineet said:   1 decade ago
Please also define the resion of other option, why is not corret.


Post your comments here:

Your comments will be displayed after verification.