java中 Testa 不能被解释成一个类型?为什么 ?代码如下
packageDogpack;classSuperclassa{privateinta;Superclassa(){System.out.println("supercl...
package Dogpack;
class Superclassa{
private int a;
Superclassa(){
System.out.println("superclass()");
}
Superclassa(int a){
System.out.println("superclass()"+a);
this.a=a;
}
class Testa extends Superclassa{
private int a;
Testa(int a){
System.out.println("superclass"+a);
this.a=a;
}
Testa(){
super(300);
System.out.println("superclass()"+a);
}
}
}
public class Testclass01 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Testa t=new Testa();
Testa t=new Testa(200);
}
} 展开
class Superclassa{
private int a;
Superclassa(){
System.out.println("superclass()");
}
Superclassa(int a){
System.out.println("superclass()"+a);
this.a=a;
}
class Testa extends Superclassa{
private int a;
Testa(int a){
System.out.println("superclass"+a);
this.a=a;
}
Testa(){
super(300);
System.out.println("superclass()"+a);
}
}
}
public class Testclass01 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Testa t=new Testa();
Testa t=new Testa(200);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询