Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can you call a constructor within a constructor?

Answer Posted / amit kumar gupta

yes we can call by super() or this();

public abstract class Class1{

public Class1(){
System.out.println("Class1");
}
}

public class Class2 extends Class1{

public Class2(String Name){
System.out.println("Name = " + Name);
}

public Class2(){
this("AMIT"); // use only one this or super
super();
}
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is comparator in java?

1006


Why doesn't the java library use a randomized version of quicksort?

997


What is the purpose of tostring() method in java?

1160


Why Java doesn’t support multiple inheritance?

1048


How do you add an element to a hashset in java?

1012


When we serialize an object does the serialization mechanism saves its references too?

1021


How can you write a loop indefinitely in java programming?

1037


Does treeset use compareto?

983


What is fundamental datatype?

1000


What is scope & storage allocation of static, local and register variables? Explain with an example.

1020


Can a method inside a interface be declared as final?

1008


What do you mean by mnemonics?

1053


What is difference between path and classpath in java?

1032


What is a arraylist in java?

1080


What is difference between throw and throws ?

1143