System
Learn to interact with system-related information.
The System
class provides methods for interacting with system-related information. Such as current time, system environment, system user, path, etc.
Methods
currentTimeMillis()
:
Returns the current time in milliseconds as a number.
nanoTime()
:
Returns the current value of the system's high-resolution time source in nanoseconds as a number.
lineSeparator()
:
Returns the platform-specific line separator as a string.
getenv()
:
Returns the system environment as a string.
Additional environment variables accessible through getenv()
include:
"USERPROFILE": Path to the current user's profile directory.
"TEMP" and "TMP": Paths to the temporary directory.
"USERNAME": The username of the currently logged-in user.
"COMPUTERNAME": Name of the computer.
"OS": Information about the operating system.
"SYSTEMROOT" or "WINDIR": Paths to the Windows system directory.
"APPDATA": Path to the directory where application-specific data for the current user is stored.
Last updated