This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

re : System class

 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15203
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic