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 is reflexive association?

1691


Is zero a natural number?

974


What is methods and methodology?

968


Write a factorial program using recursion in java?

945


Which collection allows duplicate values in java?

921


What will be the initial value of an object reference which is defined as an instance variable?

1076


What is queue in java?

1066


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

980


What is use of map in java?

950


List two java ide’s?

989


Does java trim remove newline?

924


What's the access scope of protected access specifier?

988


What is the vector class in java programming?

1005


What is a programming object?

1017


Can you call a method on a null object?

967