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]
3 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]3 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
In a @return tag statement the description:
Bond [772]

Answer:

Option A is the correct choice answer for the above question.

Explanation:

The programming concept says that every function returns some value. If the return value is not defined by the user then the function returns the garbage value otherwise it returns the defined value by the user.

The return value is defined by the user with the help of the "return" statement and with the help of the following syntax-

return value; // The return statement.

Hence the option A is right because it satisfies the above concept while the other is not because--

  • Option B states that it must be longer than one line which is not correct.
  • Option C states that it cannot be longer than one line but this line does not make any sense about the returned statement.
  • Option D states that it describes the parameter value which is the wrong definition about the returned statement.
6 0
3 years ago
Read 2 more answers
The _____ feature enables you to represent text as colorful visuals.
Radda [10]

Answer:

complex formatting feature enables you to represent text as colorful

visuals.

mark as brainliest

4 0
2 years ago
Write a program to find and print the sum of the first n cubes in the following four ways.
klio [65]

Answer:

The solution code is written in Java.

  1. public class Main {
  2.    public static void main(String[] args) {
  3.           System.out.print("Please enter a number: ");
  4.           Scanner console = new Scanner(System.in);
  5.           int n = console.nextInt();
  6.           calculateSum1(n);
  7.           calculateSum2(n);
  8.           calculateSum3(n);
  9.           calculateSum4(n);
  10.    }
  11.    public static void calculateSum1 (int num){
  12.        int sum1 = 0;
  13.        for(int i=1; i <= num; i++){
  14.            sum1 += i*i*i;
  15.        }
  16.        System.out.println("Sum 1 : " + sum1);
  17.    }
  18.    public static void calculateSum2 (int num){
  19.        int sum2 = num * num * (num + 1) * (num + 1) / 4;
  20.        System.out.println("Sum 2 : " + sum2);
  21.    }
  22.    public static void calculateSum3 (int num){
  23.        int sum3 = 0;
  24.        for(int i=1; i <=num; i++){
  25.            sum3 += i;
  26.        }
  27.        sum3 = sum3 * sum3;
  28.        System.out.println("Sum 3 : " + sum3);
  29.    }
  30.    public static void calculateSum4 (int num){
  31.        int sum4 = (num * (num + 1) * (2*num + 1)) / (4+2);
  32.        System.out.println("Sum 4 : " + sum4);
  33.    }
  34. }

Explanation:

Firstly we create four different methods that calculate the sum of the first n cubes in different ways (Line 13 - 43).

This is important to understand the concept of  operator precedence to work out the different ways of summation.

For example, The operator * and / will always have higher precedence than +.

On another hand, any expression enclosed within the parenthesis will have highest precedence and therefore the value will be evaluated prior to others.  

This is also important to understand the expression evaluation will always start from left to right.

3 0
4 years ago
John would like to move from the city into the suburbs and has been saving up a large down payment for a home. Which is the most
fenix001 [56]
I there any answer choices ?


5 0
4 years ago
A motor controller controls the and of the motors.
o-na [289]

Answer:

yes. and?

Explanation:

is that all?

4 0
3 years ago
Other questions:
  • When formatting documents, ____ settings determine where text begins on a line in relation to the left margin?
    8·1 answer
  • In this mode, your presentation will fill up the entire screen. Auto Default Standard Window
    6·2 answers
  • How did the movie characterized being a genius on real genius movie
    13·2 answers
  • Use induction on n to prove that fir all n&gt;=2, 2^n+3^n&lt;5^n
    11·1 answer
  • Double[][] vals =
    8·1 answer
  • 2 A_______<br> uses graphics or pictures to help the user navigate and<br> access programs
    14·1 answer
  • Why dose this keep popping up i dont understand plz resond first person gets branilest
    13·1 answer
  • Pls answer this
    5·1 answer
  • Horizontal and vertical flips are often used to create ___.
    12·1 answer
  • Write a program, TwoDimentionalGrid. Ask the user to enter the size of the 2 dimensional array. Here we are not doing any input
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!