The moose likes Beginning Java and the fly likes re : System class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "re : System class" Watch "re : System class" New topic

re : System class

ragi singh
Ranch Hand

Joined: Mar 10, 2010
Posts: 198

Hi ,

In the java docs its mentioned that the System class is defined as :- public final class System
and that it cannot be instantiated . I cannot understand why System class cannot be instantiated , as it is not static .
Darryl Burke

Joined: May 03, 2008
Posts: 4523

You seem to be conflating different concepts here. A class being final doesn't have anything to do with whether or not an instance can be created.

Read the source of System.java which you will find in the src.zip archive in your jdk installation folder. Do you see a constructor? What access modifier is applied/ What do the comments say?

luck, db
There are no new questions, but there may be new answers.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

ragi singh wrote:I cannot understand why System class cannot be instantiated , as it is not static .

Top-level classes cannot be static. And 'static' does not have anything to do with whether a class can be instantiated or not.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
subject: re : System class
Similar Threads
Private Constructor
If abstract classes can't be instantiated, what is System.in?
classes with private constructors can not be subclassed?
abstract class
why System class instance cannot be instatiated