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...

how to call One constructor from another;

Answer Posted / ajay

Hi,

Using super you can invoke constructor which is in parent
class. to invoke constructor which is in the same class we
have to use this. for example:

public class Point {
int m_x;
int m_y;

//============ Constructor
public Point(int x, int y) {
m_x = x;
m_y = y;
}

//============ Parameterless default constructor
public Point() {
this(0, 0); // Calls other constructor.
}
. . .
}

Is This Answer Correct ?    21 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is array passed by reference in java?

1024


How does a cookie work in Servlets?

838


Why do you canvas?

1036


What are the steps involved to write rmi based programs?

1009


Explain about static nested classes in java?

1059


What are the advantages of user defined functions?

991


Can constructor be static or final?

1084


Why we used break and continue statement in java?

1129


Is char a data type in java?

966


why using interface interface ?

2038


State two differences between C and Java.

1322


What is final method?

1061


What do you understand by java?

971


What is method in java with example?

941


What are java annotations?

1147