1)
Code:
class IPhone {
public void displayFeatures() {
[Link]("This is an iPhone with standard features");
}
}
class IPhone14 extends IPhone {
public void displayFeatures() {
[Link]("iPhone 14 features: 6.1-inch display, A15 Bionic chip, Dual-camera system");
}
}
class IPhone15 extends IPhone {
public void displayFeatures() {
[Link]("iPhone 15 features: 6.7-inch display, A16 Bionic chip, Triple-camera system");
}
}
class Main {
public static void main(String[] args) {
IPhone phone1 = new IPhone14();
IPhone phone2 = new IPhone15();
[Link]();
[Link]();
}
}
Output: