java.lang
Class System

java.lang.Object
  extended by java.lang.System

public final class System
extends Object

System represents system-wide resources; things that represent the general environment. As such, all methods are static.

Since:
1.0

Field Summary
static PrintStream err
           
static PrintStream out
           
 
Method Summary
static void arraycopy(Object src, int srcStart, Object dest, int destStart, int len)
          Copy one array onto another from src[srcStart] ...
static long currentTimeMillis()
          Get the current time, measured in the number of milliseconds from the beginning of Jan.
static void exit(int status)
          Terminate the Virtual Machine.
static String getProperty(String key)
          Get a single system property by name.
static String getProperty(String key, String def)
          Get a single system property by name.
static int identityHashCode(Object o)
          Get a hash code computed by the VM for the Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

public static final PrintStream out

err

public static final PrintStream err
Method Detail

currentTimeMillis

public static long currentTimeMillis()
Get the current time, measured in the number of milliseconds from the beginning of Jan. 1, 1970. This is gathered from the system clock, with any attendant incorrectness (it may be timezone dependent).

Returns:
the current time
See Also:
Date

arraycopy

public static void arraycopy(Object src,
                             int srcStart,
                             Object dest,
                             int destStart,
                             int len)
Copy one array onto another from src[srcStart] ... src[srcStart+len-1] to dest[destStart] ... dest[destStart+len-1]. First, the arguments are validated: neither array may be null, they must be of compatible types, and the start and length must fit within both arrays. Then the copying starts, and proceeds through increasing slots. If src and dest are the same array, this will appear to copy the data to a temporary location first. An ArrayStoreException in the middle of copying will leave earlier elements copied, but later elements unchanged.

Parameters:
src - the array to copy elements from
srcStart - the starting position in src
dest - the array to copy elements to
destStart - the starting position in dest
len - the number of elements to copy
Throws:
NullPointerException - if src or dest is null
ArrayStoreException - if src or dest is not an array, if they are not compatible array types, or if an incompatible runtime type is stored in dest
IndexOutOfBoundsException - if len is negative, or if the start or end copy position in either array is out of bounds

identityHashCode

public static int identityHashCode(Object o)
Get a hash code computed by the VM for the Object. This hash code will be the same as Object's hashCode() method. It is usually some convolution of the pointer to the Object internal to the VM. It follows standard hash code rules, in that it will remain the same for a given Object for the lifetime of that Object.

Parameters:
o - the Object to get the hash code for
Returns:
the VM-dependent hash code for this Object
Since:
1.1

getProperty

public static String getProperty(String key)
Get a single system property by name. A security check may be performed, checkPropertyAccess(key).

Parameters:
key - the name of the system property to get
Returns:
the property, or null if not found
Throws:
java.lang.SecurityException - if permission is denied
NullPointerException - if key is null
IllegalArgumentException - if key is ""

getProperty

public static String getProperty(String key,
                                 String def)
Get a single system property by name. A security check may be performed, checkPropertyAccess(key).

Parameters:
key - the name of the system property to get
def - the default
Returns:
the property, or def if not found
Throws:
java.lang.SecurityException - if permission is denied
NullPointerException - if key is null
IllegalArgumentException - if key is ""

exit

public static void exit(int status)
Terminate the Virtual Machine. This just calls Runtime.getRuntime().exit(status), and never returns. Obviously, a security check is in order, checkExit.

Parameters:
status - the exit status; by convention non-zero is abnormal
Throws:
java.lang.SecurityException - if permission is denied
See Also:
Runtime.exit(int)