1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
s344n2d4d5 [400]
2 years ago
10

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)
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 ArrayList
new ArrayList()
A: III only
B: I and II only
C: I and III only
D:II and III only
E: I, II, and III
Computers and Technology
1 answer:
bogdanovich [222]2 years ago
7 0

Answer:

B: new ArrayList()

Explanation:

When dealing with Java syntax you always need to initialize an ArrayList object with its constructor. From the options listed the only correct option would be B: new ArrayList(). This would correctly initialize the ArrayList object but is not necessarily the recommended way of doing this. The truly recommended way would be the following

ArrayList<Thing> a = new ArrayList<Thing>()

You might be interested in
Best programming languages? So far I have only learned html.​
Volgvan

Answer:

it's all up to personal preference some different ones have upsides and downsides but it's more of what you feel is best

4 0
2 years ago
A table with a width set to 600 pixels will look ________ on a monitor with resolution set to 640 × 480 than on a monitor with r
egoroff_w [7]
There are no options.

It would, however, look larger.
3 0
2 years ago
Write a function: function solution(N); that, given a positive integer N, prints the consecutive numbers from 1 to N, each on a
koban [17]

Answer:

<em>The program written in Python is as follows:</em>

def solution(N):

     concat = ""

     for i in range(1,N+1):

           if not(i%2 == 0 or i%3 ==0 or i%5 == 0):

                 print(str(i))

           else:

                 if i%2 == 0:

                       concat= concat+"Codility"

                 if i%3 == 0:

                       concat= concat+"Testers"

                 if i%5 == 0:

                       concat= concat+"Coders"

                 print(concat)

                 concat = ""

N = int(input("Enter a positive integer: "))

solution(N)

Explanation:

This line declares the function

def solution(N):

This line initializes a variable named concat to an empty string

     concat = ""

This line iterates from 1 to the input integer

     for i in range(1,N+1):

<em>This line checks if the current number of iteration is divisible by 2,3 or 5, if no, the number is printed</em>

           if not(i%2 == 0 or i%3 ==0 or i%5 == 0):

                 print(str(i))

<em>If otherwise</em>

           else:

<em>This lines checks if current number is divisible by 2; if yes the string "Codility" is concatenated to string concat</em>

                 if i%2 == 0:

                       concat= concat+"Codility"

<em>This lines checks if current number is divisible by 3; if yes the string "Testers" is concatenated to string concat</em>

<em>                 </em> if i%3 == 0:

                       concat= concat+"Testers"

<em>This lines checks if current number is divisible by 2; if yes the string "Coders" is concatenated to string concat</em>

                 if i%5 == 0:

                       concat= concat+"Coders"

<em>The concatenated string is printed using this line</em>

                 print(concat)

This variable concat is intialized back to an empty string

                 concat = ""

The main method starts here

N = int(input("Enter a positive integer: "))

This line calls the defined function solution

solution(N)

6 0
3 years ago
Given two 3x3 arrays of integer, x1 and x2, write the code needed to copy every value from x1 to its corresponding element in x2
Reika [66]

Answer:

#include<iostream>

#include<iomanip>

using namespacestd;

int main ()

{

int x1[3][3]={1,2,3,4,5,6,7,8,9};

int x2[3][3];

int i,j;

for(i=0;i<3;i++)

for(j=0;j<3;j++)

x2[i][j] = x1[i][j];

cout<<"copy from x1 to x2 , x2 is :";

for(i=0;i<3;i++)

for(j=0;j<3;j++)

cout<<x2[i][j]<<" ";

cout<<endl;

system("pause");

return 0;

}

/* Sample output

copy from x1 to x2 , x2 is :1 2 3 4 5 6 7 8 9

Press any key to continue . . .

*/

Explanation:

5 0
3 years ago
What general strategies can the network managers use to reduce congestions?
Harrizon [31]

Answer:

 There are different types of strategies that can be used by the network manager for reducing the congestion are as follows:

  • By monitoring the traffic of the network properly we can easily reduce the congestion in the network.
  • By segmenting the network properly, it helps to reduce the network congestion.
  • We can also reconfiguring the TCP/IP (Transmission control protocol) setting on the network.
  • We can also use the backpressure routing technique.

7 0
2 years ago
Other questions:
  • Monetary Policy can be either Expansionary or Contractionary. Which of the following actions classify as Expansionary Monetary P
    7·2 answers
  • Who is typically considered to be the father of computing
    6·1 answer
  • When did mac start? when did windows start? when did lynux start?
    13·2 answers
  • A terrible new disease, HORSEVID, has begun to spread among horses worldwide. Stable manager Jimmy is trying to take as many pre
    5·1 answer
  • What term best describes the way the dns name space is organized?
    9·1 answer
  • How many spaces should you use for an indent?
    10·1 answer
  • Given two strings s and t of equal length, the Hamming distance between s and t, denoted dH(s,t), is the number of corresponding
    6·1 answer
  • Does technology shape society or does society shape technology?
    14·1 answer
  • Write a method named addCommas that accepts a string representing a number and returns a new string with a comma at every third
    10·1 answer
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!