what is the use of a super keyword?

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


Please Help Members By Posting Answers For Below Questions

What are the rules regarding quotation marks?

455


How do I download and install eclipse on windows 10?

428


Is it correct to say that using parentheses can only change?

473


Describe the principles of oops.

488


What is java web application?

454






What about javascript? : java security

517


What is cache in java?

490


Why are lambda functions called lambda?

468


Do I need jdk or jre?

463


What is interceptor in java?

460


What is an api in java?

480


In an htm form i have a button which makes us to open another page in 15sec.how will you do that?

1349


What is java ioc?

481


How do I find jre version?

463


What is a cookie in java?

507