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

Difference between abstract and concrete class ?

1164


Can I learn java without any programming experience?

1033


do I need to use synchronized on setvalue(int)? : Java thread

1005


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

997


What is difference between add() and addelement() in vector?

1520


FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?

3464


What is the protected method modifier?

1039


Which of the following is not an isolation level in the JDBC

2121


What are the disadvantages of using inner classes?

1171


What does snprintf return?

996


Why is a singleton bad?

948


Is linkedlist thread safe in java?

989


What do you mean by chromounits in java8?

946


What happens if we override only equals?

969


What is main function purpose?

1029