bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java System Methods

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.

MethodDescriptionReturn 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 nanosecondslong
exit()Terminates the running Java program. A nonzero status indicates abnormal terminationvoid
gc()Suggests that the Java Virtual Machine run the garbage collectorvoid
getProperty()Gets the system property indicated by the key, or returns the default value if not foundString
getProperties()Returns all system properties as a Properties objectProperties
setProperty()Sets the system property indicated by the keyString
clearProperty()Removes the system property indicated by the keyString
arraycopy()Copies elements from the source array into the destination arrayvoid
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 variablesMap<String,String>
getenv()Returns the value of the specified environment variable, or null if it does not existString
inStandard input stream (usually the keyboard)InputStream
outStandard output stream (usually the console). Often used with println()PrintStream
errStandard error output stream (usually the console)PrintStream

Previous

Java Collections Class Methods

Next

Java Errors and Exception Types