aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "re : System class" Watch "re : System class" New topic
Author

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
Bartender

Joined: May 03, 2008
Posts: 4527
    
    5

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: 14103
    
  16

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: re : System class