Z
Zalek Bloom
Hello,
Sun Java tutorial says:
If you attempt to instantiate an abstract class, the compiler displays
an error similar to the following and refuses to compile your program:
AbstractTest.java:6: class AbstractTest is an abstract class.
It can't be instantiated.
new AbstractTest();
^
1 error
But in one of the examples it is written:
Calendar cal = Calendar.getInstance();
Now the Calendar is an abstract class defined as:
public abstract class Calendar extends Object implements Serializable,
Cloneable
Now, isn't the command "cal = Calendar.getInstance()"
instantialization?
The result is the same as with "new" - creating an object and putting
a reference to "cal".
Zalek
Sun Java tutorial says:
If you attempt to instantiate an abstract class, the compiler displays
an error similar to the following and refuses to compile your program:
AbstractTest.java:6: class AbstractTest is an abstract class.
It can't be instantiated.
new AbstractTest();
^
1 error
But in one of the examples it is written:
Calendar cal = Calendar.getInstance();
Now the Calendar is an abstract class defined as:
public abstract class Calendar extends Object implements Serializable,
Cloneable
Now, isn't the command "cal = Calendar.getInstance()"
instantialization?
The result is the same as with "new" - creating an object and putting
a reference to "cal".
Zalek