Java9 (2) 模块化

Submitted by Lizhe on Mon, 11/13/2017 - 16:36

 

499

498

module HelloworldModule {
}

 

package name.lizhe.helloworld;
public class App {
    public static void main(String[] args) {
        System.out.println("Hello World from Module! :)"); // nothing special here, standard java < 9 class.
    }
}

 

 

module HelloworldModuleWithUI {
    requires java.desktop;
}

 

package name.lizhe.helloworld;

import javax.swing.JOptionPane;

public class App {
    public static void main(String[] args) {
        JOptionPane.showMessageDialog(null, "Hello, Modular World!");
    }
}

 

702