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
Mamont248 [21]
2 years ago
10

Write a program that adds the numbers 1 through 5 into the numbers ArrayList and then prints out the first element in the list.

Engineering
1 answer:
nekit [7.7K]2 years ago
6 0

Answer:

Answer code is given below along with comments to explain each step

Explanation:

Method 1:

// size of the array numbers to store 1 to 5 integers

int Size = 5;  

// here we have initialized our array numbers, the type of array is integers and size is 5, right now it is empty.

ArrayList<Integer> numbers = new ArrayList<Integer>(Size);

// lets store values into the array numbers one by one

numbers.add(1)

numbers.add(2)

numbers.add(3)

numbers.add(4)

numbers.add(5)

// here we are finding the first element in the array numbers by get() function, the first element is at the 0th position

int firstElement = numbers.get(0);

// to print the first element in the array numbers

System.out.println(firstElement);  

Method 2:

int Size = 5;  

ArrayList<Integer> numbers = new ArrayList<Integer>(Size);

// here we are using a for loop instead of adding manually one by one to store the values from 1 to 5

for (int i = 0; i < Size; i++)  

{

// adding the values 1 to 5 into array numbers

  numbers.add(i);  

}

//here we are finding the first element in the array numbers

int firstElement = numbers.get(0);  

// to print the first element in the array

System.out.println(firstElement);  

You might be interested in
Dear sir i want to ask something about the solution of my question?
Eva8 [605]
No you may not ask the question
3 0
2 years ago
a coil consists of 200 turns of copper wire and has a cross-sectional area of 0.8mm square . The mean length per turn is 80 cm a
Amanda [17]

Answer:

The picture below with the answer. Hope it helps, have a great day/night and stay safe! Length of the coil,

8 0
3 years ago
If the head loss in a 30 m of length of a 75-mm-diameter pipe is 7.6 m for a given flow rate of water, what is the total drag fo
Stolb23 [73]

Answer:

526.5 KN

Explanation:

The total head loss in a pipe is a sum of pressure head, kinetic energy head and potential energy head.

But the pipe is assumed to be horizontal and the velocity through the pipe is constant, Hence the head loss is just pressure head.

h = (P₁/ρg) - (P₂/ρg) = (P₁ - P₂)/ρg

where ρ = density of the fluid and g = acceleration due to gravity

h = ΔP/ρg

ΔP = ρgh = 1000 × 9.8 × 7.6 = 74480 Pa

Drag force over the length of the pipe = Dynamic pressure drop over the length of the pipe × Area of the pipe that the fluid is in contact with

Dynamic pressure drop over the length of the pipe = ΔP = 74480 Pa

Area of the pipe that the fluid is in contact with = 2πrL = 2π × (0.075/2) × 30 = 7.069 m²

Drag Force = 74480 × 7.069 = 526468.1 N = 526.5 KN

3 0
3 years ago
How many power station do we have​
loris [4]

Answer: 9,719

Explanation:

5 0
2 years ago
What is the name of the first federation vessel in star trek hint 17?
Nitella [24]

Answer:

The Fesarius

Explanation:

It's the first vessel

7 0
2 years ago
Other questions:
  • Saturated water vapor undergoes a throttling process from 1bar to a 0.35bar. What is the change in temperature for this process?
    10·1 answer
  • Define ""acidity"" of an aqueous solution. How do you compare the strength of acidity of solutions ?
    6·1 answer
  • In digital communication technologies, what is an internal network also known as?
    9·1 answer
  • Water discharging into a 10-m-wide rectangular horizontal channel from a sluice gate is observed to have undergone a hydraulic j
    12·1 answer
  • Refrigerant-134a enters an adiabatic compressor at -30oC as a saturated vapor at a rate of 0.45 m3 /min and leaves at 900 kPa an
    13·1 answer
  • A crystalline grain of aluminum in a metal plate is situated so that a tensile load is oriented along the [1 1 1] direction. Wha
    9·1 answer
  • Find the total present worth of a series of cash flows with an annual interest rate of 2% per year. Round your answer to the nea
    5·1 answer
  • PLS HELP! which statement is the best example of how society affects the useof technology? A. Farmers in hilly areas grow crops
    10·1 answer
  • It is possible to design a reactor where the scy conductor and the nitrogen/ammonia electrode operate at different temperatures.
    12·1 answer
  • Precast concrete curtain wall panels: Group of answer choices are typically manufactured on site and then hoisted into place. of
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!