执行此代码时出现错误。为什么我得到不能从静态上下文引用的非静态变量?
class javatest{
public abstract class Employee {
public abstract void names();
}
public class Banani extends Employee{
@Override
public void names(){
System.out.println("I am at Banani.");
}
}
public class Shyamoli extends Employee{
@Override
public void names(){
System.out.println("I am at Shyamoli");
}
}
public static void main(String[] args){
Employee south = new Banani();
Employee north = new Shyamoli();
north.names();
south.names();
}
}
杨魅力
桃花长相依
喵喔喔
慕码人8056858
相关分类