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

Explain the difference between an Interface and an Abstract class?

1113


What is the basic difference between string and stringbuffer object?

1024


Is java code slower than native code?

1002


Difference between string, stringbuffer and stringbuilder?

985


Can we define a package statement after the import statement in java?

1018


What is boolean used for?

985


Why java is secure? Explain.

970


Are primitives objects?

1001


Explain about interthread communication and how it takes place in java?

963


What is the difference between normal report & matrix report?

1053


What is the use of pattern in java?

994


What are the basic interfaces of java collections framework?

1043


What is the difference between procedural and object-oriented programs?

927


What is diamond operator in java?

896


what is the messsage u r going to get from an objectoriented programing?

2048