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
What is java web application?
What is java persistence api used for?
What is the difference between java se and java ee?
Can we use lambda without functional interface?
How do I open the java control panel?
Why bean class is used in java?
Which type of stream is in java?
How do I open java console?
Why there are no global variables in java?
Does netbeans need jdk?
In hibernate what is the difference between the Session and SessionFactory?
What if I write static public void instead of public static void?
What is a driver in java?
What is log4j in java?
When do we go for java 8 stream api? Why do we need to use java 8 stream api in our projects?