Purpose of the System class - Core Java

What is the purpose of the System class?

1. System class is provided with useful fields (static members) pertaining to the environment.

2. Standard input,output and error output streams are provided with System class. These are used to access the externally defined properties and environment variables.

Example :
System.in - external property for input device.
System.out – external property for output device

3. Other useful methods that interact with external system / environment are:

- currentTimeMillis() – returns the current time in milliseconds
- exit() - terminates currently running JVM
- gc() - invokes the garbage collector
- getProperties() - returns the system properties.

4. The System class can not be instantiated.

5. The System class contains several useful class fields and methods.

6. Some System class features are:
- Standard input
- Standard output
- Error output streams
- Access to externally defined "properties"
- A means of loading files and libraries
- A utility method for quickly copying a portion of an array

7. The System class cannot be instantiated.
How are this() and super() used with constructors? - Core Java
How are this() and super() used with constructors? - this() constructor is invoked within a method of a class, if the execution of the constructor is to be done before the functionality of that method...
Purpose of finalization - Core Java
What is the purpose of finalization? - Finalization is the facility to invoke finalized() method. The purpose of finalization is to perform some action before the objects get cleaned up...
Difference between the File and RandomAccessFile classes - Core Java
Difference between the File and RandomAccessFile classes - The File class is used to perform the operations on files and directories of the file system of an operating system...
Post your comment