IDEA在主函数给其他传递参数出现“cannot be referenced from a static context”的解决方法

IDEA在主函数给其他传递参数出现“cannot be referenced from a static context”的解决方法

图中在主函数的showFly出现了“cannot be referenced from a static context”错误,是因为主函数本身是static,新建的方法showFly中没有输入static,所以正确写法要为public static void showFly(FlyAble f)

IDEA在主函数给其他传递参数出现“cannot be referenced from a static context”的解决方法