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 / tulasi prasad

We can call the parent class constructor from the child
class constructor.

class Parent
{
int a;
Parent(int x)
{
a=x;
}
}
class Child extends Parent
{
int b;
Child(int x,int y)
{
super(x);
b=y;
System.out.println(a);
System.out.println(b);
}
}

class Test
{
public static void main(String args[])
{
Child obj = new Child(1,2);
}
}

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is method with example?

1107


What is a pattern what is an anti pattern?

967


What does this () mean in java?

977


How do you use equal in java?

1072


How many types of operators are there?

979


explain the difference between jdk and jvm?

992


What is meant by distributed application? Why are we using that in our application?

944


How variables are stored in memory?

998


What is the difference between multiple processes and multiple threads?

1199


Can we define package statement after import statement in java?

1030


What are daemon Threads in java?

1194


What does you mean in math?

1082


What is public static void main?

1094


What is type inference in java8?

1040


describe method overloading

1014