package com.javaproficiency;
class Y {
void display(){
System.out.println(" Y is called");
}
}
public class X extends Y{
void display(){
System.out.println(" X is called");
}
public static void main(String[] args) {
Y y = new Y();
X x = new X();
Y obj = new X();
y.display();
x.display();
obj.display();
}
}
class Y {
void display(){
System.out.println(" Y is called");
}
}
public class X extends Y{
void display(){
System.out.println(" X is called");
}
public static void main(String[] args) {
Y y = new Y();
X x = new X();
Y obj = new X();
y.display();
x.display();
obj.display();
}
}
Output:
Y is called
X is called
X is called
very useful blog
ReplyDeleteBest Selenium Training in Chennai | Android Training in Chennai | Java Training in chennai | Webdesigning Training in Chennai
well explained post thanks for sharing
ReplyDeleteBest Selenium Training Center in chennai | Best Automation Testing Training in Chennai
Thanks for sharing this unique and informative content which provided me the required information.
ReplyDeleteunix training in chennai