java类的继承1

2019年2月15日22:40:32 发表评论 3,161 views
/**
 * Created by xabcd on 2019/2/15.
 */
public class jicheng {
    String name;
    int age;
}
class Student2 extends jicheng{
    String school;
}



import java.util.SplittableRandom;

/**
 * Created by xabcd on 2019/2/15.
 */
public class java_jicheng
{

    public static void main(String[] srgs)
    {
        Student2 s = new Student2();
        s.name = "张三";
        s.age = 25;
        s.school = "北京";
        System.out.println("姓名"+s.name+",年龄:"+s.age+",学校:"+s.school);
    }
}



结果:
姓名张三,年龄:25,学校:北京



发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: