GeezerVison is showing docs.oracle.com — System (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.lang
Class System
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
static PrintStream |
err |
The "standard" error output stream.
|
static InputStream |
in |
The "standard" input stream.
|
static PrintStream |
out |
The "standard" output stream.
|
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods
| Modifier and Type |
Method |
Description |
static void |
arraycopy(Object src,
int srcPos,
Object dest,
int destPos,
int length) |
Copies an array from the specified source array, beginning at the
specified position, to the specified position of the destination array.
|
static String |
clearProperty(String key) |
Removes the system property indicated by the specified key.
|
static Console |
console() |
Returns the unique Console object associated
with the current Java virtual machine, if any.
|
static long |
currentTimeMillis() |
Returns the current time in milliseconds.
|
static void |
exit(int status) |
Terminates the currently running Java Virtual Machine.
|
static void |
gc() |
Runs the garbage collector.
|
static Map<String,String> |
getenv() |
Returns an unmodifiable string map view of the current system environment.
|
static String |
getenv(String name) |
Gets the value of the specified environment variable.
|
static Properties |
getProperties() |
Determines the current system properties.
|
static String |
getProperty(String key) |
Gets the system property indicated by the specified key.
|
static String |
getProperty(String key,
String def) |
Gets the system property indicated by the specified key.
|
static SecurityManager |
getSecurityManager() |
Gets the system security interface.
|
static int |
identityHashCode(Object x) |
Returns the same hash code for the given object as
would be returned by the default method hashCode(),
whether or not the given object's class overrides
hashCode().
|
static Channel |
inheritedChannel() |
Returns the channel inherited from the entity that created this
Java virtual machine.
|
static String |
lineSeparator() |
Returns the system-dependent line separator string.
|
static void |
load(String filename) |
Loads the native library specified by the filename argument.
|
static void |
loadLibrary(String libname) |
Loads the native library specified by the libname
argument.
|
static String |
mapLibraryName(String libname) |
Maps a library name into a platform-specific string representing
a native library.
|
static long |
nanoTime() |
Returns the current value of the running Java Virtual Machine's
high-resolution time source, in nanoseconds.
|
static void |
runFinalization() |
Runs the finalization methods of any objects pending finalization.
|
static void |
runFinalizersOnExit(boolean value) |
Deprecated.
This method was originally designed to enable or disable
running finalizers on exit. Running finalizers on exit was disabled
by default. If enabled, then the finalizers of all objects whose
finalizers had not yet been automatically invoked were to be run before
the Java runtime exits. That behavior is inherently unsafe. It may
result in finalizers being called on live objects while other threads
are concurrently manipulating those objects, resulting in erratic
behavior or deadlock.
|
static void |
setErr(PrintStream err) |
Reassigns the "standard" error output stream.
|
static void |
setIn(InputStream in) |
Reassigns the "standard" input stream.
|
static void |
setOut(PrintStream out) |
Reassigns the "standard" output stream.
|
static void |
setProperties(Properties props) |
Sets the system properties to the Properties
argument.
|
static String |
setProperty(String key,
String value) |
Sets the system property indicated by the specified key.
|
static void |
setSecurityManager(SecurityManager s) |
Sets the System security.
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Field Detail
-
in
public static final InputStream in
The "standard" input stream. This stream is already
open and ready to supply input data. Typically this stream
corresponds to keyboard input or another input source specified by
the host environment or user.
-
Method Detail
-
arraycopy
public static void arraycopy(Object src,
int srcPos,
Object dest,
int destPos,
int length)
Copies an array from the specified source array, beginning at the
specified position, to the specified position of the destination array.
A subsequence of array components are copied from the source
array referenced by src to the destination array
referenced by dest. The number of components copied is
equal to the length argument. The components at
positions srcPos through
srcPos+length-1 in the source array are copied into
positions destPos through
destPos+length-1, respectively, of the destination
array.
If the src and dest arguments refer to the
same array object, then the copying is performed as if the
components at positions srcPos through
srcPos+length-1 were first copied to a temporary
array with length components and then the contents of
the temporary array were copied into positions
destPos through destPos+length-1 of the
destination array.
If dest is null, then a
NullPointerException is thrown.
If src is null, then a
NullPointerException is thrown and the destination
array is not modified.
Otherwise, if any of the following is true, an
ArrayStoreException is thrown and the destination is
not modified:
- The
src argument refers to an object that is not an
array.
- The
dest argument refers to an object that is not an
array.
- The
src argument and dest argument refer
to arrays whose component types are different primitive types.
- The
src argument refers to an array with a primitive
component type and the dest argument refers to an array
with a reference component type.
- The
src argument refers to an array with a reference
component type and the dest argument refers to an array
with a primitive component type.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
- The
srcPos argument is negative.
- The
destPos argument is negative.
- The
length argument is negative.
srcPos+length is greater than
src.length, the length of the source array.
destPos+length is greater than
dest.length, the length of the destination array.
Otherwise, if any actual component of the source array from
position srcPos through
srcPos+length-1 cannot be converted to the component
type of the destination array by assignment conversion, an
ArrayStoreException is thrown. In this case, let
k be the smallest nonnegative integer less than
length such that src[srcPos+k]
cannot be converted to the component type of the destination
array; when the exception is thrown, source array components from
positions srcPos through
srcPos+k-1
will already have been copied to destination array positions
destPos through
destPos+k-1 and no other
positions of the destination array will have been modified.
(Because of the restrictions already itemized, this
paragraph effectively applies only to the situation where both
arrays have component types that are reference types.)
- Parameters:
src - the source array.
srcPos - starting position in the source array.
dest - the destination array.
destPos - starting position in the destination data.
length - the number of array elements to be copied.
- Throws:
IndexOutOfBoundsException - if copying would cause
access of data outside array bounds.
ArrayStoreException - if an element in the src
array could not be stored into the dest array
because of a type mismatch.
NullPointerException - if either src or
dest is null.
-
identityHashCode
public static int identityHashCode(Object x)
Returns the same hash code for the given object as
would be returned by the default method hashCode(),
whether or not the given object's class overrides
hashCode().
The hash code for the null reference is zero.
- Parameters:
x - object for which the hashCode is to be calculated
- Returns:
- the hashCode
- Since:
- JDK1.1
-
gc
public static void gc()
Runs the garbage collector.
Calling the gc method suggests that the Java Virtual
Machine expend effort toward recycling unused objects in order to
make the memory they currently occupy available for quick reuse.
When control returns from the method call, the Java Virtual
Machine has made a best effort to reclaim space from all discarded
objects.
The call System.gc() is effectively equivalent to the
call:
Runtime.getRuntime().gc()
- See Also:
Runtime.gc()
-
runFinalizersOnExit
@Deprecated
public static void runFinalizersOnExit(boolean value)
Deprecated. This method was originally designed to enable or disable
running finalizers on exit. Running finalizers on exit was disabled
by default. If enabled, then the finalizers of all objects whose
finalizers had not yet been automatically invoked were to be run before
the Java runtime exits. That behavior is inherently unsafe. It may
result in finalizers being called on live objects while other threads
are concurrently manipulating those objects, resulting in erratic
behavior or deadlock.
Throws UnsupportedOperationException.
The call System.runFinalizersOnExit() is effectively
equivalent to the call:
Runtime.runFinalizersOnExit()
- Parameters:
value - ignored
- Since:
- JDK1.1
- See Also:
Runtime.runFinalizersOnExit(boolean)
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|