package com.company;
/**
* Created by henson on 17-8-28.
*/
public class Student extends Person{
String school;
int score;
void sayHello(Student another){
System.out.println(
"Hi");
if (school==another.school)
System.out.println(
"We are Schoolmates");
}
boolean isGoodstudent(){
return score>
90;
}
void testThisSuper(){
int a;
a=age;
a=
this.age;
a=
super.age;
}
void sayHello(){
super.sayHello();
System.out.println(
"My school is "+school);
}
Student(String name,
int age,String school){
super(name,age);
this.school=school;
System.out.println(
"Hello! Student(String name,int age,String school)");
}
Student(){
System.out.println(
"Hello! Student()");
}
public static void main(String[] args){
Person p2=
new Student(
"Zhangyi",
20,
"THU");
Student s2=(Student)p2;
}
}
写继承类的时候,果然忘了有些参数了,IDEA太好用了,有依赖性,有毒。 打脸了要做笔记。
关于抓取:用 try except 错误的语句 忽略进入下一步 或者将它循环