question archive Assume that class Vehicle contains the following method
Subject:Computer SciencePrice:9.82 Bought3
Assume that class Vehicle contains the following method. public void setPn'celdoulJle price] { 1"" implementation not shown "7' } Also assume that class Car extends Vehicle and contains the following method. public void setPriceldouble price) { 3"" implementation not shown *I' } Assume Vehicle v is initialized as follows. Vehicle v = new Carl): v.5etPricel1000.U}: Which of the following is true? (9 The code above will cause a compile-time error, because a subclass cannot have a method with the same name and the same signature as its superclass. The code above will cause a run-time error, because a subclass cannot have a method with the same name and the same signature as its superclass. © The code above will cause a compile-time error because of type mismatch. ® The code v.5etPricel1000.D); will cause the setPrice method of the Car class to be called. (9 The code v.setPrice(lDOlJ.D); will cause the setPrice method of the Vehicle class to be called.
Purchased 3 times