The System class in Java provides access to system resources and settings. It offers a variety of methods to perform system-level operations, such as reading environment variables, interacting with system properties, and managing input/output streams.
This guide covers various methods available in the System class. Each method is described in simple terms to help beginners understand how to use them.
Java System Methods
The table below contains various methods of the Java System class, each with a link to a detailed explanation, examples, and real-world uses. Click on the method names to learn more about how to use them effectively in your applications.
| Method | Description |
|---|---|
| arraycopy() | Copies a specified range of elements from one array to another. |
| clearProperty() | Removes the system property indicated by the specified key. |
| console() | Returns the unique Console object associated with the current Java virtual machine. |
| currentTimeMillis() | Returns the current time in milliseconds since the epoch. |
| gc() | Requests the Java Virtual Machine to run the garbage collector. |
| getenv() | Returns the value of the specified environment variable. |
| getProperties() | Returns the current system properties. |
| getProperty() | Gets the system property indicated by the specified key. |
| lineSeparator() | Returns the system-dependent line separator string. |
| loadLibrary() | Loads the specified dynamic library. |
| mapLibraryName() | Maps a library name into a platform-specific string representing a native library. |
| setProperties() | Sets the system properties to the specified properties. |
| setProperty() | Sets the system property indicated by the specified key. |
The System class is part of the java.lang package. It provides essential methods for interacting with system resources and properties, making it easier to manage system-level operations in Java programming.
For more detailed information, please refer to the official Java SE Documentation.