代码示例:
package com.thb;
public class Test5 {
public static void main(String[] args) {
// 获取与当前Java应用关联的runtime
Runtime runtime = Runtime.getRuntime();
System.out.println("available processors: " + runtime.availableProcessors());
}
}
运行输出: