Cannot make a static reference to the non-static method的解决方法
报错原因:在一个类中写了一个publicStringgetContent()方法和一个main()方法,getContent()方法中包含了getClass()方法,在main()方法中直接调用了getContent()就出现如题的错误。这样一样解决方法:先实例化类,然后再调用getContent(...
java 中 Cannot make a static reference to the non-static 解决方法
今天敲代码的时候遇到了这个问题,大体这个问题可以简化成这样;publicclassTest1{publicStringget(){return"123";}publicstaticvoidmain(String[]args){Stringstring=get();}}显示Cannotmakeasta...