错误提示:cannot be referenced from a static context

可能的原因: 自定义类放错了位置,写在了main方法中却没有定义static。