小编Ful*_*son的帖子

如何在另一个类中调用一个类的main()方法?

如何main()在另一个类中调用一个类的方法?我有两个类SaveDataDynamicTest.这两个类都包含一个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)

java methods program-entry-point class object

5
推荐指数
1
解决办法
2257
查看次数

标签 统计

class ×1

java ×1

methods ×1

object ×1

program-entry-point ×1