本想调试一下看程序走的路线,但调试程序时出的问题不解,为什么报不知源后又有输出?望详解!
import java.util.Scanner;
abstract class Per {
private int a;
private int b;
public Per(int a, int b) {
super();
this.a = a;
this.b = b;
}
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
public int getB() {
return b;
}
public void setB(int b) {
this.b = b;
}
abstract void put();
}
class h extends Per {
int y;
public h(int a, int b) {
super(a, b);
}
@Override
public String toString() {
return "a = " + getA() + " b = " + getB();
}
public void put() {
System.out.println(999);
}
}
public class pra3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
h h1 = new h(sc.nextInt(), sc.nextInt());
h1.put();
h1.y = sc.nextInt();
// 为什么调试程序时进入 h1 这一步后,到了tostring那里的输出,会报告找不到源 ?但是之后又会输出
System.out.println(h1);
System.out.println(h1.getA());
}
}