Monday, May 22, 2006

Constructors

1). When no constructors have been declared in a class, the compiler automatically generates a default constructor. The default constructor has no arguments and inherits the same access modifier as the class.

2). If you invoke the default constructor of your class and the superclass does not have a constructor without any arguments, your code will not compile. The reason is that the subclass default constructor makes an implicit call to the no-argument constructor of its superclass.

0 Comments:

Post a Comment

<< Home