Answer Posted / swamireddy
the super keyword is used for accessing a base class
constructor values of the sub class.actually constructor
values are not inherited to the derived class.the super
keyword using inherited easily
for example:
import java.io.*;
class a
{
int x,y;
a(int i,int j)
{
x=i;
y=j;
System.out.ptintln(" "+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
48 4
| Is This Answer Correct ? | 7 Yes | 4 No |
Post New Answer View All Answers
What is microservices java?
What if I do not provide the string array as the argument to the method?
Which version of my browser should I use? : java security
Why we use beans in java?
What is the difference between lambdas and delegates?
Why dependency injection is used in java?
Who is at risk in java? : java security
What is loose coupling in java?
What is predicate in lambda expression?
how can we create the ui using netbeans,having the code?
What is a jvm?
What is the difference between a jdk and a jvm?
What is meant by rest api in java?
In java thread programming, which method is a must implementation for all threads?
What is maven in java?