Hi here I come again with puzzle about constructor.
As we know if we don’t create constructor it is by default created .
But imagine a situation where you have created parameterized constructor??????
Let’s take a look at following code snippet
Class A
{ A(int a){ }
}
Class B extends A
{
   }
class c extends B
{
  //Now imagine a situation where you need to call a parameterized constructor of A.
Probably you will choose
A a=new A(5);
}
Wait!!!!!!!!!!!!!!
I would like to take a stand and say no!!!.
Because if there is any parameterized constructor then you need to put default constructor manually.
So the redefination of class A goes like this
Class A
{ A(){
}
   A(int a){
}
}

7 thoughts on “top tricky Puzzles about constructor”

  1. Good day! This is my 1st comment here so I just wanted to give a quick shout out and say I truly enjoy reading your posts. Can you suggest any other blogs/websites/forums that cover the same topics? Thanks a ton!|

  2. Simply desire to say your article is as astonishing. The clearness in your post is simply cool and i could assume you’re an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please carry on the rewarding work.

  3. Admiring the time and energy you put into your website and detailed information you provide. It’s good to come across a blog every once in a while that isn’t the same outdated rehashed information. Fantastic read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

  4. Good day! This is my first comment here so I just wanted to give a quick shout out and tell you I really enjoy reading through your posts. Can you recommend any other blogs/websites/forums that deal with the same subjects? Thanks for your time!|

  5. Magnificent goods from you, man. I have bear in mind your stuff prior to and you are just extremely wonderful. I actually like what you have received right here, certainly like what you are saying and the best way wherein you assert it. You make it enjoyable and you continue to take care of to keep it wise. I cant wait to learn much more from you. This is actually a tremendous web site.|

  6. It is appropriate time to make some plans for the longer term and it is time to be happy. I have learn this put up and if I could I wish to recommend you few attention-grabbing things or suggestions. Perhaps you can write next articles relating to this article. I wish to learn more things about it!

Leave a Reply

Your email address will not be published. Required fields are marked *