Discussion
Which one is a valid declaration of a boolean?
Answer: C
Correct answer: boolean b3 = false;
A boolean accepts only the literals true and false. Java performs no conversion between numbers and booleans, so 0 is not accepted - the C idiom of zero meaning false does not carry over. 'false' in single quotes is a char literal and in any case too long to be one, Boolean.false() is not a method, and no is an undeclared identifier.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development