Previous


1.1 Changes: System Class

Deprecated Methods

The first column in the following table lists the methods in the System class that are deprecated in the JDK 1.1. The second column lists alternatives for those methods:

Deprecated Methods Alternatives
getenv(String) getProperty(String)

The getenv method has been out of use for several releases of the JDK. The 1.1 release formalizes this change by deprecating the method. Programmers should use Properties to store information between invocations of a program. Setting Up and Using Properties(in the Writing Java Programs trail) talks about how to use the Properties class and Managing Locale-Sensitive Data(in the Writing Java Programs trail) shows you how to use properties to help internationalize your Java programs.

New Methods

The following methods were added to the System class for the JDK 1.1:
setErr(PrintStream)
setIn(InputStream)
setOut(PrintStream)
runFinalizersOnExit(boolean)
identityHashCode(Object)
The setErr, setIn, and setOut methods reassign the standard error, standard input and standard output streams, respectively. The Standard I/O Streams in this lesson discusses these streams.

runFinalizersOnExit determines whether or not finalize methods are invoked when a program is exiting. By default, this is turned off. Cleaning Up Unused Objects(in the Writing Java Programs trail) talks about finalize methods and garbage collection in more detail.

identityHashCode returns a hash code for the specified object. Hash codes are not covered in this tutorial. Use the online API documentation for the Object(in the API reference documentation) class for information.


Previous