Get Number of Available Processors



To display the number of processors available to a certain Java Virtual Machine there is a method of the Runtime class called availableProcessors().
To get an instance of the Runtime class we have to call the static method getRuntime(). The example below illustrates how to go about displaying the number of processors.

On the machine where this example was tested the output looked like this:







Search for more Java info on this site here:
Custom Search


Any thoughts or questions?