Java Reference
In-Depth Information
Quiz
Review today's material by taking this three-question quiz.
Questions
1. Which of the following is a valid value for a boolean variable?
a. “false”
b. false
c. 10
2. Which of these is not a convention for naming variables in Java?
a. After the first word in the variable name, each successive word begins with a
capital letter.
b. The first letter of the variable name is lowercase.
c. All letters are capitalized.
3. Which of these data types holds numbers from 32,768 to 32,767?
a. char
b. byte
c. short
Answers
1. b. In Java, a boolean can be only true or false . If you put quotation marks
around the value, it will be treated like a String rather than one of the two
boolean values.
2. c. Constant names are capitalized to make them stand out from other variables.
3. c.
Certification Practice
The following question is the kind of thing you could expect to be asked on a Java pro-
gramming certification test. Answer it without looking at today's material.
Which of the following data types can hold the number 3,000,000,000 (three billion)?
a. short , int , long , float
b. int , long , float
c. long , float
d. byte
 
Search WWH ::




Custom Search