<< 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

what is mutation
Janga Reply
what is a cell
Sifune Reply
how is urine form
Sifune
what is antagonism?
mahase Reply
classification of plants, gymnosperm features.
Linsy Reply
what is the features of gymnosperm
Linsy
how many types of solid did we have
Samuel Reply
what is an ionic bond
Samuel
What is Atoms
Daprince Reply
what is fallopian tube
Merolyn
what is bladder
Merolyn
what's bulbourethral gland
Eduek Reply
urine is formed in the nephron of the renal medulla in the kidney. It starts from filtration, then selective reabsorption and finally secretion
onuoha Reply
State the evolution relation and relevance between endoplasmic reticulum and cytoskeleton as it relates to cell.
Jeremiah
what is heart
Konadu Reply
how is urine formed in human
Konadu
how is urine formed in human
Rahma
what is the diference between a cavity and a canal
Pelagie Reply
what is the causative agent of malaria
Diamond
malaria is caused by an insect called mosquito.
Naomi
Malaria is cause by female anopheles mosquito
Isaac
Malaria is caused by plasmodium Female anopheles mosquitoe is d carrier
Olalekan
a canal is more needed in a root but a cavity is a bad effect
Commander
what are pathogens
Don Reply
In biology, a pathogen (Greek: πάθος pathos "suffering", "passion" and -γενής -genēs "producer of") in the oldest and broadest sense, is anything that can produce disease. A pathogen may also be referred to as an infectious agent, or simply a germ. The term pathogen came into use in the 1880s.[1][2
Zainab
A virus
Commander
Definition of respiration
Muhsin Reply
respiration is the process in which we breath in oxygen and breath out carbon dioxide
Achor
how are lungs work
Commander
where does digestion begins
Achiri Reply
in the mouth
EZEKIEL
what are the functions of follicle stimulating harmones?
Rashima Reply
stimulates the follicle to release the mature ovum into the oviduct
Davonte
what are the functions of Endocrine and pituitary gland
Chinaza
endocrine secrete hormone and regulate body process
Achor
while pituitary gland is an example of endocrine system and it's found in the Brain
Achor
what's biology?
Egbodo Reply
Biology is the study of living organisms, divided into many specialized field that cover their morphology, physiology,anatomy, behaviour,origin and distribution.
Lisah
biology is the study of life.
Alfreda
Biology is the study of how living organisms live and survive in a specific environment
Sifune
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