【发布时间】:2014-07-27 06:39:30
【问题描述】:
我觉得这个程序写得很好。它没有给我任何错误,但也没有给我任何输出。这有什么问题?我检查了其他程序以查看 Eclipse 是否有任何问题,但除此之外所有其他程序都在运行。
注意:我是 Java 新手。详细说明问题。我知道我把继承的拼写写错了。
public class Inheritence {
int a;
String b;
Inheritence(int x, String y) {
a = x;
b = y;
}
}
class B extends Inheritence {
int c;
B(int j, String k, int l) {
super(4, "Srimanth");
a = j;
k = b;
c = l;
}
public static void main(String args[]) {
Inheritence obj1 = new Inheritence(4, "Srimanth");
B obj2 = new B(4, "Srimanth", 5);
System.out
.println("The details of the guy are" + obj1.a + " " + obj1.b);
System.out.println("The details of the guy are" + obj2.c);
}
}
【问题讨论】:
-
这个程序没有任何错误。您是否期望以下输出? : 这家伙的详细信息是 4 Srimanth 这家伙的详细信息是 5。
-
请在有帮助的时候尝试重新启动 eclipse
-
是的。我期待那个输出。但它没有显示在输出窗口中。
-
您是不是看错了控制台?
-
您的代码有效。请检查错误日志。