I was wondering recently why do both java.lang.Runtime and java.lang.System have the same methods for library loading, garbage collecting and similar operations. Is it because of historical reasons, for convenience, or they really differ? Both classes are available from JDK 1.0…
I was wondering recently why do both java.lang.Runtime and java.lang.System have the same methods
Share
System exposes various things it might be appropriate for a developer to use the System for.
I would be concerned about a programmer playing directly with the Runtime. For System to call the methods, they need to be exposed.
System provides an interface to the Runtime to enable access to Runtime methods that are appropriate to be called by programmers. Call the System methods and let them delegate appropriately.