运行 ❯
获取您自己的
Java 服务器
×
更改方向
更改主题,暗/亮
前往 Spaces
class Person { protected String fname = "John"; protected String lname = "Doe"; protected String email = "john@doe.com"; protected int age = 24; } class Student extends Person { private int graduationYear = 2018; public static void main(String[] args) { Student myObj = new Student(); System.out.println("Name: " + myObj.fname + " " + myObj.lname); System.out.println("Email: " + myObj.email); System.out.println("Age: " + myObj.age); System.out.println("Graduation Year: " + myObj.graduationYear); } }
姓名:John Doe
邮箱:
[email protected]
年龄:24
毕业年份:2018