<< Chapter < Page Chapter >> Page >

Answer 13

Question 14

True or False? There is a class named Arrays that contains various methods for manipulating arrays (such as sorting and searching) . The Arrays class contains many overloaded versions of the sort method. As usual, each overloaded version of the sort method requires a different argument list.

Answer 14

Question 15

Given: Listing 1 makes two calls to overloaded sort methods of the Arrays class using the following overloaded methods. (Note that I omitted generics syntax from the signatures because generics is beyond the scope of this course .)

  • sort(Object[] a)
  • sort(Object[] a, Comparator c)

True or False? In Listing 1 , the call to the first sort method in the above list produces the following output:

Tom TOM Joe JOE Bill BILL

Answer 15

Question 16

True or False? In Listing 1 , the call to the second sort method in the above list produces the following output:

Tom TOM Joe JOE Bill BILL

Answer 16

Listings

What is the meaning of the following two images?

These images were inserted here simply to insert some space between the questions and the answers to keep them from being visible on the screen at thesame time.

Spacer image of a rabbit and a penguin.

This image was also inserted for the purpose of inserting space between the questions and the answers.

Spacer image of a penguin and some houses.

Answers

Answer 16

True.

Back to Question 16

Answer 15

False. Here is what the documentation has to say about this overloaded version of the Arrays.sort method:

Sorts the specified array of objects into ascending order, according to the natural ordering of its elements. All elements in the array must implementthe Comparable interface.

According to that specification, the output would be:

BILL Bill JOE Joe TOM Tom

Back to Question 15

Answer 14

True.

Back to Question 14

Answer 13

True.

Back to Question 13

Answer 12

True.

Back to Question 12

Answer 11

False. By default, a Vector object does not sort the elements. Therefore, the output order is the same as the input order shown inthe fillIt method.

Joe Bill Tom JOE BILL TOM

Back to Question 11

Answer 10

True.

Back to Question 10

Answer 9

True.

Back to Question 9

Answer 8

False. The position of each element in an ordered collection is determined by a numeric index associated with the element and is independent ofthe value of the element.

Back to Question 8

Answer 7

True.

Back to Question 7

Answer 6

False. Because a Vector object is a List object, (and not a Set object) it is allowed to contain duplicate elements.

Back to Question 6

Answer 5

False. A Vector object is a List object. The Vector class implements the Collection interface and the List interface but not the Set interface.

Back to Question 5

Answer 4

Collection data

Joe Bill Tom JOE BILL TOM

Raw array data

Joe Bill Tom JOE BILL TOM

Natural order sorted array data

BILL Bill JOE Joe TOM Tom

Custom order sorted array data

Tom TOM Joe JOE Bill BILL

Collection data

Joe Bill Tom JOE BILL TOM

Back to Question 4

Answer 3

True.

Back to Question 3

Answer 2

True.

Back to Question 2

Answer 1

False. The Collection interface declares a method named toArray , which can be called on a Collection object to "return an array containing all of the elements in this collection whose runtime type is that ofthe specified array" .

Questions & Answers

how to study physic and understand
Ewa Reply
what is conservative force with examples
Moses
what is work
Fredrick Reply
the transfer of energy by a force that causes an object to be displaced; the product of the component of the force in the direction of the displacement and the magnitude of the displacement
AI-Robot
why is it from light to gravity
Esther Reply
difference between model and theory
Esther
Is the ship moving at a constant velocity?
Kamogelo Reply
The full note of modern physics
aluet Reply
introduction to applications of nuclear physics
aluet Reply
the explanation is not in full details
Moses Reply
I need more explanation or all about kinematics
Moses
yes
zephaniah
I need more explanation or all about nuclear physics
aluet
Show that the equal masses particles emarge from collision at right angle by making explicit used of fact that momentum is a vector quantity
Muhammad Reply
yh
Isaac
A wave is described by the function D(x,t)=(1.6cm) sin[(1.2cm^-1(x+6.8cm/st] what are:a.Amplitude b. wavelength c. wave number d. frequency e. period f. velocity of speed.
Majok Reply
what is frontier of physics
Somto Reply
A body is projected upward at an angle 45° 18minutes with the horizontal with an initial speed of 40km per second. In hoe many seconds will the body reach the ground then how far from the point of projection will it strike. At what angle will the horizontal will strike
Gufraan Reply
Suppose hydrogen and oxygen are diffusing through air. A small amount of each is released simultaneously. How much time passes before the hydrogen is 1.00 s ahead of the oxygen? Such differences in arrival times are used as an analytical tool in gas chromatography.
Ezekiel Reply
please explain
Samuel
what's the definition of physics
Mobolaji Reply
what is physics
Nangun Reply
the science concerned with describing the interactions of energy, matter, space, and time; it is especially interested in what fundamental mechanisms underlie every phenomenon
AI-Robot
what is isotopes
Nangun Reply
nuclei having the same Z and different N s
AI-Robot
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask