Aim:- Write a program to
implement Overriding in java.
JAVA Code :-
import java.lang.*;
class A {
void display(){
System.out.println("In parent class
");
}
}
class B extends A {
void display() {
System.out.println("In chlid class
");
}
}
class overriding {
public static void main(String args[]) {
B obj =new B();
obj.display();
}
}
Output:-
No comments:
Post a Comment