Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Which one is correct about the following piece of code in java: 1 2 3 4 in 10 5 6 7 8 9 10
Which one is correct about the following piece of code in java: 1 2 3 4 in 10 5 6 7 8 9 10 11 12 13 14 15 class Car { public static void main(String args[]) { Car c= new Car(); BMW b new BMW (); = } c.print(); b.print(); } void print() { System.out.println("Superclass Car"); } } public class BMW extends Car { void print() {System.out.println("Subclass BMW"); } Java The print method in the Car class overloads the Print method in the BMW class The print method print in the BMW class overrides the print method in the Car class A superclass variable can only shadow a subclass variable BMW is the superclass and Car is the subclass
Step by Step Solution
★★★★★
3.40 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
The provided code contains several syntax errors making it difficult to accurately determine the int...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started