package com.company;
class super1
{
public void sp()
{
System.out.println("this is a super phone");
}
public void on()
{
System.out.println("super phone starting...");
}
}
class sub1 extends super1
{
public void sbp()
{
System.out.println("this is a super phone");
}
public void on()
{
System.out.println("sub phone starting...");
}
}
public class program49 {
public static void main(String[] args) {
super1 obj=new sub1();
obj.sp();
obj.on(); //run the on() function of sub class
}
}
Hi Friends ! You are on HR Developers website. Here you can find the codes of different languages like c ,c++ , java, pyton and many other languages.
Monday, July 26, 2021
simple program using Dynamic Method Dispatch in Java (Java) (212)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment