Answer Posted / upasana das
example of inheritance using super keyword
class a
{
int x,y;
a(int i,int j)
{
x=i;
y=j;
System.out.println(" "+x+" "+y);
}
}
class b extends a
{
int g;
b(int i,int j)
{
super(i,j);
g=i+i*(j*j);
System.out.println(g);
}
}
class mab
{
public static void main(String args[])
{
b ob=new b(24,2);
}
}
output: 24 2
120
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Is it better to learn java or python?
Why sun introduce concept of anonymous class? What is need and real life use of anonymous class
What is stateless class in java?
Describe the principles of oops.
What is difference between loosely coupled and tightly coupled in java?
Can we extract main method from another class?
What is an action class in java?
Describe life cycle of thread?
Who created eclipse?
What is dependency injection in java?
Is jdk an ide?
Explain different way of using thread?
What is microservices java?
What is lazy loading in jpa?
What is javacpl?