简体   繁体   中英

Method not being able to be called from another class

Currently I'm refactoring some old code, it was 16k lines of 1 object that did everything in the application. I inherited it and my goal is to make it better. For some reason when I'm pulling out a method making it into it's own class, the first class wont allow me to call the second method.

(Giant object) Saveapp

BuildXMLFarmEndorsement buildFarmXML = new BuildXMLFarmEndorsement();
    buildFarmXML.buildXMLFarmEndorsements( multi, i);

for what ever reason my IDE will not recognize the code above. Here is the code of the new class

new class:

@SuppressWarnings("serial")
public class BuildXMLFarmEndorsement  implements java.io.Serializable {
    public void buildXMLFarmEndorsements(MultiApp multi, int i) throws Exception{do some stuff}
}

Any help would be much appreciated.

Check the packages and the visibility. And your imports.

我觉得很傻,我只是在方法之外调用类。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM