/* 继承:
1.提高代码复用性,
2.让类与类之间产生关系,有了这个关系才有了多态的特性
注意:
千万不要为了获取其他类的功能,简化代码而继承;
必须是类与类之间有所属关系才可以继承。
*/
class Extend
{
public static void (String[] args)
{
Student a=new Student();
a.name="lisi";
System.out.println(a.name);
}
}
class person
{
String name;
int age;
}
class Student extends person
{
void study()
{
System.out.println("goood study");
}
}
class worker extends person
{
void work()
{
System.out.println("good work");
}
}