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

E. Arrays and ArrayLists > Answers to Self-Review Exercises

Answers to Self-Review Exercises

E.1

a. arrays.

b. variables, type.

c. enhanced for statement.

d. index (or subscript or position number).

e. two-dimensional.

f. for ( double d : numbers ).g) an array of Strings, called args by convention.

E.2

a. False. An array can store only values of the same type.

b. False. An array index must be an integer or an integer expression.

c. For individual primitive-type elements of an array: False. A called method receives and manipulates a copy of the value of such an element, so modifications do not affect the original value. If the reference of an array is passed to a method, however, modifications to the array elements made in the called method are indeed reflected in the original. For individual elements of a reference type: True. A called method receives a copy of the reference of such an element, and changes to the referenced object will be reflected in the original array element.


  

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