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 language is java written?

1058


What is the difference between preemptive scheduling and time slicing in java programming?

1074


What is the difference between stringbuffer and stringbuilder class?

1162


What is a arraylist in java?

1128


Is java se open source?

1083


What makes a function well defined?

1036


What is finally block?

1129


What are the differences between abstract class and interface?

1163


Explain the concept of proper inheritance?

1109


Write a java program to count the number of words present in a string?

1025


What do you mean by a JVM?

1358


What is array list in java?

1128


Is java 9 released?

1066


What are locale settings?

1033


Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?

1213