abstract class aclass { abstract void m1();}
class aex1 extends aclass { void m1() {System.out.println("aex1");}}class aex2 extends aclass { void m1() {System.out.println("aex2");}}public class test {
void test(aclass a) {
a.m1();} public static void main(String[] args) {
aclass a1 = new aex1();
aclass a2 = new aex2();
test(a1);
test(a2); }
}---------------------运行提示有错误如下:
non-static method test(aclass) cannot be referenced from a static context
test(a1);
non-static method test(aclass) cannot be referenced from a static context
test(a2);问题出在哪里呢?
class aex1 extends aclass { void m1() {System.out.println("aex1");}}class aex2 extends aclass { void m1() {System.out.println("aex2");}}public class test {
void test(aclass a) {
a.m1();} public static void main(String[] args) {
aclass a1 = new aex1();
aclass a2 = new aex2();
test(a1);
test(a2); }
}---------------------运行提示有错误如下:
non-static method test(aclass) cannot be referenced from a static context
test(a1);
non-static method test(aclass) cannot be referenced from a static context
test(a2);问题出在哪里呢?
to ftiger(哈哈鱼):thanks。