Java System Class Methods

The System class in Java provides various useful methods and fields for interacting with the environment in which the application is running. It offers functionality to manage properties, environment variables, and system resources such as standard input, output, and error 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. These methods allow you to perform operations like copying arrays, accessing system properties, and invoking the garbage collector, making it a valuable tool for system-level programming.

For more detailed information, please refer to the official Java SE Documentation.

Java System Class 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 an array from the specified source array to the specified position of the destination array.
clearProperty() Removes the system property indicated by the specified key.
console() Returns the unique Console object associated with the current Java virtual machine, if any.
currentTimeMillis() Returns the current time in milliseconds.
gc() Suggests that the Java virtual machine expend effort toward recycling unused objects to make the memory they currently occupy available for quick reuse.
getenv() Returns the value of the specified environment variable.
getProperties() Determines 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 properties object.
setProperty() Sets the system property indicated by the specified key.