A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
re : System class
Joined: Mar 10, 2010
Nov 10, 2010 22:28:08
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 .
Joined: May 03, 2008
Nov 10, 2010 22:37:50
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?
There are no new questions, but there may be new answers.
Jesper de Jong
Joined: Aug 16, 2005
Nov 11, 2010 00:18:43
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
- My blog about Scala
I agree. Here's the link:
subject: re : System class
why System class instance cannot be instatiated
If abstract classes can't be instantiated, what is System.in?
classes with private constructors can not be subclassed?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014