class
unknown
java
2 years ago
767 B
2
Indexable
Never
public abstract class Engineer { public static String name() { return "Engineer"; } public String favorite() { return "Math and Physics"; } public static void main(String[] args) { Engineer e2 = new ElectricalEngineer(); Engineer e3 = new SoftwareEngineer(); System.out.format("%s %s \n", e2.name(), e2.favorite()); System.out.format("%s %s", e3.name(), e3.favorite()); } } class ElectricalEngineer extends Engineer { public static String name() { return "Electrical Engineer" } public String favorite() { return "Electricity"; } } class SoftwareEngineer extends Engineer { public static String name() { return "Software Engineer"; } public String favorite() { return "Java"; } }