Java - Abstraction
Given this code:
What is the output?
abstract class Device {
abstract void turnOn();
void status() {
System.out.println("Device is ready");
}
}
class Phone extends Device {
void turnOn() {
System.out.println("Phone is on");
}
}
class Laptop extends Device {
void turnOn() {
System.out.println("Laptop is on");
}
}
public class Test {
public static void main(String[] args) {
Device d1 = new Phone();
Device d2 = new Laptop();
d1.status();
d2.turnOn();
}
}What is the output?
