如何main()在另一个类中调用一个类的方法?我有两个类SaveData和DynamicTest.这两个类都包含一个main()方法.我想在DynamicTest课堂上运行我的主要课程.我该怎么称呼SaveData?
public class SaveData {
private static final Map<String, Object> myCachedTreeMap = new TreeMap<String, Object>();
public static final List<String> getLines(final String resourceParam, final Charset charset) throws IOException{
System.out.println("Please get: "+resourceParam);
if (myCachedTreeMap.containsKey(resourceParam) ) {
// Use the cached file, to prevent an additional read.
System.out.println("Found in memory : "+resourceParam);
}
else {
// Load the file from disk
System.out.println("Not Found in memory : "+resourceParam);
}
return null;
} …Run Code Online (Sandbox Code Playgroud)