abstract class abc{
int num;
int num1;
String name;
abc(){
}
abc(int n1,int n2,String name1){
num=n1;
num1=n2;
name=name1;
}
int sj(){
return num*num1;
}
abstract void sj2();
}
class a extends abc{
static int sum=0;
a(int n1,int n2,String name1){
super(n1,n2,name1);
}
void sj2(){
sum= num+num1;
}
public static void main(String []w)
{
a t=new a(2,9,"li");
System.out.println(t.sj());
System.out.println(sum);
// System.out.println(t.sj2());
}
}
打印SUM总是0,不知道为什么。