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

what do you understand by the term string with respect to java?

1098


What is the default value of byte datatype in java?

974


What is the difference between processes and threads?

1108


What are new features introduced with java 8 ?

1041


Why to use nested classes in java?

1181


What is meant by design patterns?

1090


What are packages in java?

1785


What is maximum size of arraylist in java?

1085


How can we create an immutable class in java?

1119


How to instantiate static nested classes in java?

1132


What is data and its types?

1049


Can list contain null in java?

1142


What is runtime polymorphism or dynamic method dispatch?

1045


What is lastindexof in java?

1169


Define how can we find the actual size of an object on the heap?

1283