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 the java api?
What is the locale class?
What do you understand by casting in java language? What are the types of casting?
Can we extract main method from another class?
what is reflection api? How are they implemented?
Are jvm’s platform independent?
What if I write static public void instead of public static void?
How does java handle integer overflows and underflows?
What is the first argument of the string array in main method?
What is the resourcebundle class?