Inheriting the method in a class

class Q
void display()
{System.out.println(“Good Morning”);}
class R extends Q
void display()
{System.out.println(“Good Afternoon”);} }
class PQRdemo
public static void main(String[] args)
R r1 = new R();
r1.display(); }}
Good Afternoon



Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.