Wednesday, August 31, 2011

Get Java Runtime

    /*
    Get Java Runtime Example
    This get java runtime examples shows how to get the runtime
    in which the java application is running. Runtime allows us
    to interface with the environment in which the current
    application is running.
    */
    
    package org.best.example;
    public class GetJavaRuntime {
    
    public static void main(String args[])
    {
    /*
    * Current runtime can be obtained using getRuntime method
    * of Runtime class.
    *
    * getRuntime method is a static method. Application can not
    * create instance of this class.
    */
    
    Runtime runtime = Runtime.getRuntime();
    
    }
    }
    
    /*
    Output of this program would be,
    Current java runtime obtained!
    */

No comments: