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]
3 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]3 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
Suppose the working pressure for a boiler is 10 psig, then what is the corresponding absolute pressure?
yanalaym [24]

Answer:

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

Explanation:

From Fluid Mechanics, we remember that absolute pressure (p_{abs}), measured in pounds per square inch, is the sum of the atmospheric pressure and the working pressure (gauge pressure). That is:

p_{abs} = p_{atm}+p_{g} (1)

Where:

p_{atm} - Atmospheric pressure, measured in pounds per square inch.

p_{g} - Working pressured of the boiler (gauge pressure), measured in pounds per square inch.

If we suppose that p_{atm} = 14.696\,psi and p_{g} = 10\,psi, then the absolute pressure is:

p_{abs} = 14.696\,psi+10\,psi

p_{abs} = 24.696\,psi

The corresponding absolute pressure of the boiler is 24.696 pounds per square inch.

8 0
2 years ago
Ti-6Al-4V has a fracture toughness of 74.6 MPa-m0.5. How much stress (in MPa) would it take to fail a plate loaded in tension th
Nikitich [7]

Answer:

critical stress  = 595 MPa

Explanation:

given data

fracture toughness =  74.6 MPa-\sqrt{m}

crack length = 10 mm

f = 1

solution

we know crack length = 10 mm  

and crack length = 2a as given in figure attach

so 2a = 10

a = 5 mm

and now we get here with the help of plane strain condition , critical stress is express as

critical stress  = \frac{k}{f\sqrt{\pi a}}    ......................1

put here value and we get

critical stress  = \frac{74.6}{1\sqrt{\pi 5\times 10^{-3}}}

critical stress  = 595 MPa

so here stress is change by plane strain condition because when plate become thinner than condition change by plane strain to plain stress.

plain stress condition occur in thin body where stress through thickness not vary by the thinner section.

6 0
3 years ago
Another name for your computer, running the web browser program is: Web user The client The mainframe Browsing agent
timofeeve [1]

Answer:

Browsing agent

Explanation:

Hope this helps!

6 0
2 years ago
26 V is measured across a 220 Ω resistance. This means that resistor current equals ________. Group of answer choices 1.2 A 57 A
zysi [14]
You can use ohm’s law
I=V/R
3 0
2 years ago
X-Ray Inspection
Softa [21]
The answer is the test is being tested towards the lungs the test is done by scanning your body the tools are called “the x rat visional lock space” and the rubber tool is called a deeldo it’s purple with a pencil looking shape perfect for the body.
5 0
3 years ago
Other questions:
  • Who is the best musician in Nigeria<br>​
    11·2 answers
  • Following lockout/tagout (LOTO) procedures is important but not required when working with dangerous
    10·1 answer
  • Do all websites use the same coding to create?
    8·1 answer
  • I have a question for you guys
    13·2 answers
  • Based on the scenario, which type of engineering identifies Greg's role in Ethiopia?
    15·1 answer
  • The difference in quantity between the add and full marks on an engine oil dipstick is typically
    5·1 answer
  • If you log into the admin account on windows 10, will the admin be notified ? ​
    14·2 answers
  • Just need someone to talk to pls dont just use me for points
    5·1 answer
  • Select the correct answer. The most frequent maintenance task for a car is: A. Oil changes B. Tire replacements C. Coolant chang
    10·2 answers
  • Why does my delivery date keep changing on my tesla model 3
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!