class classA{
int age;
}
class classB extends classA{
String name;
public void getinfo(classB b){
System.out.println(name+age);
}
}
__________________________________________________________________________________________
class C{
public static void main(String args[]){
classB d=new classB;
b.getinfo(12,"jack");//这样就不行,用类作为参数传入到底怎么调用呢?
}
}
___________________________________________________________________________________________
//另外再问一下如果我用匿名对象调用classB的方法为什么返回的是Null,比如我下面这么写,匿名对象到底该怎么用呢?
class classA{
int age;
}
class classB extends classA{
String name;
public void getinfo(){
System.out.println(name+age);
}
}
class C{
public static void main(String args[]){
new Classb().name="JACK";
new Classb().age=12;
new Classb().getinfo();
}