Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
Java Programming
»
Language Fundamentals
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;
Correct Answer:
boolean b3 = false;
Explanation:
A boolean can only be assigned the literal
true
or
false
.
← Previous Question
Next Question→
More Questions from
Language Fundamentals
What is the numerical range of a char?
Which is a valid declarations of a String?
Which is a valid keyword in java?
Which one of the following will declare an array and initialize it with five numbers?
Which three are valid declarations of a float? float f1 = -343; float f2 = 3.14; float f3 = 0x12345; float f4 = 42e7; float f5 = 2001.0D; float f6 = 2.81F;
Which is a reserved word in the Java programming language?
Which three are valid declarations of a char? char c1 = 064770; char c2 = 'face'; char c3 = 0xbeef; char c4 = \u0022; char c5 = '\iface'; char c6 = '\uface';
Which four options describe the correct default values for array elements of the types indicated? int -> 0 String -> "null" Dog -> null char -> '\u0000' float -> 0.0f boolean -> true
Which one of these lists contains only Java programming language keywords?
Which three are legal array declarations? int [] myScores []; char [] myChars; int [6] myScores; Dog myDogs []; Dog myDogs [7];
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments