Flash cards
Review the key moves
1/3
Core idea
What is the main idea behind Java System Methods?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
System Methods
The System class contains several useful methods for input, output, properties, time, and memory management.
| Method | Description | Return Type |
|---|---|---|
| currentTimeMillis() | Returns the current time in milliseconds since January 1, 1970 (Unix epoch) | long |
| nanoTime() | Returns the current value of the most precise available system timer, in nanoseconds | long |
| exit() | Terminates the running Java program. A nonzero status indicates abnormal termination | void |
| gc() | Suggests that the Java Virtual Machine run the garbage collector | void |
| getProperty() | Gets the system property indicated by the key, or returns the default value if not found | String |
| getProperties() | Returns all system properties as a Properties object | Properties |
| setProperty() | Sets the system property indicated by the key | String |
| clearProperty() | Removes the system property indicated by the key | String |
| arraycopy() | Copies elements from the source array into the destination array | void |
| identityHashCode() | Returns the default hash code of the given object (even if hashCode() is overridden) | int |
| lineSeparator() | Returns the system-dependent line separator string (e.g., "\n" on Linux, "\r\n" on Windows) | String |
| getenv() | Returns an unmodifiable map of the system environment variables | Map<String,String> |
| getenv() | Returns the value of the specified environment variable, or null if it does not exist | String |
| in | Standard input stream (usually the keyboard) | InputStream |
| out | Standard output stream (usually the console). Often used with println() | PrintStream |
| err | Standard error output stream (usually the console) | PrintStream |