首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

取得处理器的数量

2012-10-24 
获得处理器的数量public class Main {/*** Displays the number of processors available in the Java Vir

获得处理器的数量

public class Main {        /**     * Displays the number of processors available in the Java Virtual Machine     */    public void displayAvailableProcessors() {                Runtime runtime = Runtime.getRuntime();                int nrOfProcessors = runtime.availableProcessors();                System.out.println("Number of processors available to the Java Virtual Machine: " + nrOfProcessors);            }        /**     * Starts the program     *     * @param args the command line arguments     */    public static void main(String[] args) {        new Main().displayAvailableProcessors();    }}


代码来自CSDN

热点排行