What is the purpose of Runtime and System class?
The System class contains several useful class fields and methods. The purpose of the System class is to provide access to system resources. It a final class available in java.lang package. We can't instantiated System class because the default constructor is private. All the members of this class is static and also the three constants defined named in ( standard input ) ,out ( standard output ) and err (error) . The "in" is a reference variable of InputStream and directed to standard input device called keyboard. The "out" and "err" are reference variables of type PrintStream and pointing towards standard output device called Monitor.
Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The purpose of the Runtime class is to provide access to the Java runtime system. It is a final class available in java.lang package . We can't instantiated Runtime class because the default constructor is private. Runtime follows Singleton Design pattern and it contains non-static methods. The runtime information like the memory availability, invoking the garbage collector , etc. we get from Runtime class.