The Java platform lets your program access system resources through a
(relatively) system-independent API implemented by the
Most system programming needs are met through the
The following diagram shows that the SystemapiIcon (in the API reference documentation) class and
through a system-dependent API implemented by the
RuntimeapiIcon (in the API reference documentation) class.
Purity Tip:
Some of the system resources available through the System
and Runtime classes cannot be used in 100% Pure Java programs.
These resources are noted throughout this lesson.
System class.
However, in rare cases, a program might have to access the system
through the Runtime object that represents the current runtime
environment. The last section of this lesson, The
"runtimeRuntime Object
explains how to do this and talks about the trade-offs of
accessing the system directly via the Runtime object.
System
class allows your Java programs to use system resources
but insulates them from system-specific details.
System class's
standard output stream used in
several examples to display text. This and other resources available
through System are briefly described here and
covered in the sections indicated.
System Class
System's methods and variables
are class methods and class variables.
You don't instantiate the System class to use it;
you use the System class's
methods and variables directly from a reference
to the System class.
System
class are the streams used for reading and writing text. The
System class provides
one stream for reading text--the standard input stream--and two streams
for writing text--the standard output and standard error streams.
System Properties
System class.
System's gc method. Also, you can
request that the runtime system
perform object finalization using System's
runFinalization method.
System class to set and get the security manager for an
application. Subclasses of java.lang.SecurityManager
implement a specific management policy.
System Methods
System class includes several miscellaneous methods
that let you get the current time in milliseconds, exit the
interpreter, and copy arrays.
Runtime Object
System class.
However, in rare cases, a program must
bypass the system-independent interface
of the System class and use system
resources directly from the runtime environment.
The Java environment provides a
RuntimeapiIcon (in the API reference documentation)object, which represents the current runtime environment.
You can use a Runtime object
to access system resources directly.
Runtime object directly compromises
your ability to run your program on different systems.
You should do this only in special situations.
Bhopal news
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100