Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

B. Introduction to Classes, Objects, Met... > Answers to Self-Review Exercises

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.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint