提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
创建类继承
public class Main { public static void main(String[] args) { Manager mgr = new Manager(); mgr.setName("Ana Bates"); /** * 时 代 J a v a 公 众 号 提 供 **/ // Get the name of the manager String mgrName = mgr.getName(); // Display the manager name System.out.println("Manager Name: " + mgrName); } }/*NowJava.com - 时代Java*/ class Employee { private String name = "Unknown"; public void setName(String name) { this.name = name; } public String getName() {