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]
2 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]2 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]2 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
What are your two biggest strengths as a student? How will these strengths help you become a self-directed learner?
zavuch27 [327]

Answer:

5tgggffyfghfh jrhrhek

7 0
3 years ago
Read 2 more answers
Which of the following protocols support the encryption and decryption of e-mail messages?
Katena32 [7]
It seems that you have missed the necessary options for us to answer this question so I had to look for it. Anyway, here is the answer. The protocol that supports the encryption and decryption of e-mail messages is this: <span>Secure Multipurpose Internet Mail Extensions (S/MIME) and Pretty Good Privacy (PGP). Hope this helps.</span>
7 0
3 years ago
Plz answer me will mark as brainliest ​
victus00 [196]

Answer:

Application

Explanation:

Application software comes in many forms like apps, and even on computers. The software is most common on computers of all kinds while mobile applications are most common on cellular devices.

3 0
3 years ago
Read 2 more answers
You are being hired as the director of IT for a small firm that does retail trade business, and you will be the source of knowle
Orlov [11]

Director of IT role is major decision maker or any IT related issue such as network security, database, network issues etc. As policy to one to one end user and it department, which should cover as follows.

1. End-user is not allowed to share files or media files to any user through email or social media.

2. Login password should not be changed without IT approval of pc or   workstation or laptop.  Once changes password should be shared to IT department.

3. Sharing password Wi-Fi or access point to outsiders to be avoided.

4. Connecting usb drive or flash drive to workstation or laptop,

5. Own laptop or smartphone should not be connected to office network.

6. If workstation or desktop or laptop is effected with virus immediately to be reported to IT department.

5 0
3 years ago
virtue by which you need to secure information by limiting computer access to authorized personnel only
Natalka [10]
I don't get what you are trying to ask...
Please explain
6 0
3 years ago
Other questions:
  • What is the difference between chrome and chromium browser?
    9·1 answer
  • Write a Python program that will take as input 5 integer values and will output the average of the odd values and the average of
    6·1 answer
  • 1. Perform the following Binary Additions 101101 + 10100 *
    13·2 answers
  • Anyone here good with python coding. I have some machine learning homework which I am having a hard time with,
    12·1 answer
  • Catering question<br> What is the hottest food in the world
    5·1 answer
  • Explain how arrays are stored in memory? Show how arr [5] is stored in the memory. Assume each memory location is one byte long
    6·1 answer
  • JAVA
    12·1 answer
  • The 0-1 knapsack problem is the following. A thief robbing a store finds n items. The ith item is worth vi dollars and weighs wi
    14·1 answer
  • What happens when the electrons flowing through the light bulb change direction?
    11·1 answer
  • What causes the hidden node problem in a wireless local area network (wlan)?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!