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
Nadya [2.5K]
3 years ago
15

Consider the following code segment: ArrayList bulbs = new ArrayList(); bulbs.add(new Light()); bulbs.remove(0); bulbs.add(new L

ight()); Light b = new Light(); bulbs.add(1, b); bulbs.add(new Light()); bulbs.remove(0); bulbs.add(new Light()); bulbs.remove(2); bulbs.add(new Light()); bulbs.add(1, new Light()); After running the code, what is the size of bulbs?
Computers and Technology
2 answers:
mezya [45]3 years ago
6 0

Answer:

4

Explanation:

ArrayList bulbs = new ArrayList();

bulbs.add(new Light()); // bulbs array length equal to 1

bulbs.remove(0); // bulbs array length equal to 0

bulbs.add(new Light()); // bulbs array length equal to 1

Light b = new Light();

bulbs.add(1, b); // bulbs array length equal to 2

bulbs.add(new Light()); // bulbs array length equal to 3

bulbs.remove(0); // bulbs array length equal to 2

bulbs.add(new Light()); // bulbs array length equal to 3

bulbs.remove(2); // bulbs array length equal to 2

bulbs.add(new Light()); // bulbs array length equal to 3

bulbs.add(1, new Light()); // bulbs array length equal to 4

Scrat [10]3 years ago
4 0
To answer this, lets run through the code:

<span>ArrayList bulbs = new ArrayList(); //create a new empty list

bulbs.add(new Light()); //size of bulbs  = 1

bulbs.remove(0); //remove item at index 0. size of bulbs = 0

bulbs.add(new Light()); // size of bulbs = 1

Light b = new Light();
bulbs.add(1, b); // size of bulbs = 2

bulbs.add(new Light()); //size of bulbs = 3

bulbs.remove(0); //remove bulb at index 0. Size of bulbs = 2

bulbs.add(new Light()); size of bulbs = 3

bulbs.remove(2); //remove bulb at index 2. size of bulbs = 2

bulbs.add(new Light()); //size of bulbs = 3

bulbs.add(1, new Light()); //inserted at position 1. size of bulbs = 4

The final answer. Size of bulbs = 4.</span>
You might be interested in
Five features of any window​
Vesna [10]

Answer:

The features of any windows are

1. Start menu

2. Notification area or task bar

3. Window snipping tools

4. Using Local Area Networks

5. Windows explorer libraries

Explanation:

8 0
3 years ago
What happens during the production stage
PSYCHO15rus [73]

Answer:

Production is where the principal photography for the movie or TV show takes place.

Explanation:

During rehearsals and camera blocking, Stand-Ins work with the Director, Assistant Director, camera crew, and other crew members to block out actor movements and lighting set-ups for a scene.

4 0
3 years ago
This is your code.
lubasha [3.4K]

Answer:

35

Explanation:

We will be going inside B array, because he was in second place in array E,and will be the first element of array B, so it's 35

E can be understanded as:

E=[[21, 'dog', 'red'],[35, 'cat', 'blue'],[12, 'fish', 'green']], so, you can see array E as array of arrays or so-called two-dimensional array

6 0
3 years ago
What was the biggest challenge you faced in getting to where you are today and how did you overcome it? Peer counseling
Solnce55 [7]
The biggest challenge I still am faced with today is loosing weight, it can be different for everyone but that is mine. I overcomed it by eating a lot better and not so much junk food.
7 0
3 years ago
What is a graphical user interface?
alex41 [277]

Answer:

A GUI (graphical user interface) is a system of interactive visual components for computer software. A GUI displays objects that convey information, and represent actions that can be taken by the user. The objects change color, size, or visibility when the user interacts with them.

Explanation:

GUI objects include icons, cursors, and buttons. These graphical elements are sometimes enhanced with sounds, or visual effects like transparency and drop shadows.

A GUI is considered to be more user-friendly than a text-based command-line interface, such as MS-DOS, or the shell of Unix-like operating systems.

6 0
4 years ago
Read 2 more answers
Other questions:
  • For each of the following six program fragments: a) Give an analysis of the running time (Big-Oh will do). b) Implement the code
    5·1 answer
  • Suppose that a program performs an intermixed sequence of (stack) push and pop operations. The push operations put the integers
    9·1 answer
  • Describe the use of technology in the promotional function
    5·2 answers
  • Joe sends a scathing e-mail to his boss regarding increased work hours. Joe tries to deny sending the e-mail, but is unable to d
    9·1 answer
  • User authentication is a procedure that allows communicating parties to verify that the contents of a received message have not
    12·1 answer
  • Which of the following is the key benefit is offered by the Internet channel? Group of answer choices Deeper assortments Immedia
    7·1 answer
  • The dramatic increase in the number of people having access to the Internet has been made possible, in part, because of the rela
    8·1 answer
  • There is only one way to change line spacing in Word.
    14·1 answer
  • What's true about freedom
    12·2 answers
  • 8.10.8 guess the passcode codehs
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!