File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring 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: 5092

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 which you will find in the 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: 15041

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 8 API documentation
jQuery in Action, 3rd edition
subject: re : System class
It's not a secret anymore!