Hi friends
I have compiled some points about constructors. Please add if you think that anything else can be added to the list or correct is anything is wrong.
1. The valid modifiers of constructors are public,protected and private. So they can't declare with any of these modifiers ( final, abstract, static,synchronized or native )
2. Constructors are not inherited.
3. If you don't have a constructor declared then the compiler will insert a non argument constructor.
4. A constructor can throws execeptions.
5. Calling both super() and this() in one constructor will generate a compilation error.
6. Coding a return with out any expression ( return; ) is valid in constructors. [b] i am
about this ! I am not able to visualize the senario when this will be needed. [b]
7. A compile-time error occurs if a default constructor is provided by the compiler but the superclass does not have a constructor that takes no arguments.
8. You can't instantiated a class with private constructor.[b] i am
about this too ! I am able to understand the reason behind this but not able to visualize the senario when this will be needed. [b]
Any help appreciated.
Thanks
ARS Kumar.
[This message has been edited by ARS Kumar (edited June 06, 2000).]