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 It is possible to synchronize the constructor of a Java Class?

1222


Why hashset is used in java?

1122


What does string mean in java?

1155


Can an abstract class be a final class?

1047


What are format specifiers in java?

1114


What is the size of arraylist in java?

1072


What is singleton class in ruby?

1069


How can you share data between two thread in Java?

992


Can I use % with real numbers?

1082


What are the two types of java?

1256


What is the use of string and stringbuffer?

1052


Java.util.regex consists of which classes?

1047


Is java util list serializable?

984


What is meant by polymorphism?

1077


What is a treeset in java?

1114