Question: The code below has just one error. If you delete just one keyword in the code, there is no error. Write the keyword that needs

The code below has just one error. If you delete just one keyword in the code, there is no error. Write the keyword that needs to be deleted.

import java.util.*;

class Pizza { ArrayList toppings = new ArrayList(); public final void addTopping(String topping) { toppings.add(topping); }

public void removeTopping(String topping) { toppings.remove(topping); } }

public class Test extends Pizza{ public void addTopping(String topping) { System.out.println("cannot add topping"); }

public static void main(String[] args) { Pizza pizza = new Pizza(); pizza.addTopping("peperoni"); pizza.addTopping("mushroom"); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!