Which of the following are valid for declaring and initialising
a boolean variable?
1. boolean b = True;
2. boolean b = 0;
3. boolean b = 1 < 2;
4. boolean b = true?false:true;
5. boolean b = true;
I had written the correct answer as 5,but when checked the correct answers were 3,4 and 5.
Ok 4 is still an acceptable answer,but can someone explain me how 3 also happens to be the right answer???
Please note that when you copy a question from a mock exam, book or other source, we require that you QuoteYourSources - so, please tell us where you copied this question from.