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

Can the garbage collection be forced by any means?

943


Explain the difference between intermediate and terminal operations in java8?

1055


Is there a case when finally will not execute?

959


Is java a security risk?

966


What do you understand by overloading and overriding in java?

1019


Explain 5 features introduced in jdk 1.7?

978


Is boolean a data type in java?

908


Why java is object oriented?

966


Difference between operator overloading and function overloading

1023


What environment variables do I need to set on my machine in order to be able to run java programs?

966


What are peerless components?

1033


How many types of parsers are there?

967


Can we use string in switch case in java?

1006


What is vector?

998


Explain some best practices you would apply while using collection in java?

985