static class Qw{
void process()throws Exception{
throw new Exception();
}
}
static class D53 extends Qw { /**
* @param args
*/
void process(){
System.out.println("B");
}
public static void main(String[] args) {
// TODO 自动生成方法存根
//Qw a=new D53();
//a.process();
new D53().process(); }}
题目说运行结果是打印出:B
但是我调试了一下,程序编译都不能通过,说class类前面不能加static修饰符。我想问的是类到底能不能加static修饰,有的话能否举个例子!在线等待高手释疑···
void process()throws Exception{
throw new Exception();
}
}
static class D53 extends Qw { /**
* @param args
*/
void process(){
System.out.println("B");
}
public static void main(String[] args) {
// TODO 自动生成方法存根
//Qw a=new D53();
//a.process();
new D53().process(); }}
题目说运行结果是打印出:B
但是我调试了一下,程序编译都不能通过,说class类前面不能加static修饰符。我想问的是类到底能不能加static修饰,有的话能否举个例子!在线等待高手释疑···
public static class B{}
}
void process()throws Exception{
throw new Exception();
}
}
static class D53 extends Qw { /**
* @param args
*/
void process(){
System.out.println("B");
}
public static void main(String[] args) {
// TODO 自动生成方法存根
//Qw a=new D53();
//a.process();
new D53().process(); } }
}static修饰类放在类里面才行
把D53的声明改成
public class D53 extends Qw