Question: 2- Consider the following program: public class Product { private int price; public void setPrice (int theprice) price = thePrice; public class Specialproduct extends Item

 2- Consider the following program: public class Product { private int

2- Consider the following program: public class Product { private int price; public void setPrice (int theprice) price = thePrice; public class Specialproduct extends Item { private int discount; public void setDiscount (int theDiscount) { discount = theDiscount; }} public class Main public static void main(String[] args) { Special Product product = new Specialproduct(); }) Which of the following compiles without a problem? Why? a. product.discount = 20; b. product.setDiscount(20); C. product.setPrice(50)

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!