which keyword is used for inheritance in Java?
shreeyab:
Welcome @chitrita
Answers
Answered by
0
keyword which is used for inheritance in java is .......... this keyword.
Answered by
1
Answer:
Extend keyword is used for inheritance in java. when we inherit a class from base class then we use extend keyword. Suppose class A is a base class and class B is inherited from class A. Then we use extend keyword for implementing inheritance.
Example of extend keyword:
class A
{
protected int x, y;
void input( int a , int b)
{
x=a;
y=b;
}
int add ( )
{
return (x+y);
}
}
class B extends A
{
int mul ( )
{
return (x*y);
}
}
class Main_class
{
public static void main( string args[] )
{ ..........
..........
.........
}
} // end of main class
Similar questions