Answers to Self-Review Exercises

B.1

a) public.

b) class.

c) new.

d) type, name.

e) default package.

f) instance variable.

g) float, double.

h) double-precision.

i) nextDouble.

j) modifier.

k) void.

l) nextLine.

m) java.lang.

n) import declaration.

o) floating-point number.

p) single-precision.

q) %f.

r) primitive, reference.

B.2

a) False. By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter.

b) True.

c) True.

d) True.

e) False. A primitive-type variable cannot be used to invoke a method—a reference to an object is required to invoke the object’s methods.

f) False. Such variables are called local variables and can be used only in the method in which they’re declared. ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.