subject

Consider the following statement, which is intended to create an ArrayList named a to store only elements of type Thing. Assume that the Thing class has been properly defined and includes a no-parameter constructor. ArrayList a = /* missing code */;
Which of the following can be used to replace /* missing code */ so that the statement works as intended?
a. new Thing().
b. new ArrayList().
c. new ArrayList(Thing).
d. new ArrayList().
e. new ArrayList<>(Thing).
2. Consider the following statement, which is intended to create an ArrayList named numbers that can be used to store Integer values. ArrayList numbers = /* missing code */;Which of the following can be used to replace /* missing code */ so that the statement works as intended?new ArrayList()new ArrayListnew ArrayList()A. III only.
B. I and II only. C. I and III only. D. II and III only. E. I, II, and III.3. Consider the following statement, which is intended to create an ArrayList named arrList to store elements only of type String./* missing code */ = new ArrayList();Which of the following can be used to replace /* missing code */ so that the statement works as intended?A. ArrayList arrList().B. ArrayList arrList.
C. ArrayList<> arrList.
D. ArrayList arrList.
E. ArrayList arrList.4. Consider the following code segment. ArrayList nums = new ArrayList<>();nums. add(3);nums. add(2);nums. add(1);nums. add(0);nums. add(0, 4);nums. set(3, 2);nums. remove(3);nums. add(2, 0);Which of the following represents the contents of nums after the code segment has been executed?A. [2, 4, 3, 2, 0].B. [3, 2, 0, 1, 0].C. [4, 2, 0, 2, 0].D. [4, 3, 0, 2, 0].E. [4, 3, 0, 3, 0].5. Consider the following code segment. ArrayList syllables = new ArrayList();syllables. add("LA");syllables. add(0, "DI");syllables. set(1, "TU");syllables. add("DA");syllables. add(2, syllables. get(0));syllables. remove(1);System. out. println(syllables. toString());What is printed as a result of executing the code segment?A. [DI, DA, DI].
B. [DI, DI, DA].C. [LA, LA, DA].
D. [TU, DI, DA].E. [TU, TU, DA].6. Consider the following code segment. ArrayList vals = new ArrayList();vals. add(vals. size(), vals. size());vals. add(vals. size() - 1, vals. size() + 1);vals. add(vals. size() - 2, vals. size() + 2);System. out. println(vals. toString());What is printed as a result of executing the code segment?A. [0, 1, 2].B. [0, 2, 4].C. [1, 2, 3].D. [2, 1, 0].E. [4, 2, 0].

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
These tools give presenters more freedom to move about the room and interact with their audience. laptop computer laser pointer lcd projector remote control
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Select the correct answer from each drop-down menu. which types of computer networks are bigger as well as smaller than a man? a man is a network of computers that covers an area bigger than a , but smaller than a .
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
What are some settings you can control when formatting columns?
Answers: 1
You know the right answer?
Consider the following statement, which is intended to create an ArrayList named a to store only ele...
Questions
question
Social Studies, 27.05.2021 05:20
question
Mathematics, 27.05.2021 05:20
Questions on the website: 13722360