What will be the output of the following program?[0.75]
interface P
{
String p =”PPPP”;
StringmethodP();
}
interface Q extends P
{
String q =”QQQQ”;
StringmethodQ();
}
class R implements P, Q
{
public StringmethodP()
{
return q+p;
}
public StringmethodQ()
{
return p+q;
}
}
public class MainClass
{
public staticvoid main(String[] args)
{
R r = new R();
System.out.println(r.methodP());
System.out.println(r.methodQ());
}
}
Learning Outcome(s):
LO 1 : Understand and be able to design and implement programsusing object oriented programming concepts like: encapsulation,inheritance, polymorphism, abstract classes and methods
Expert Answer
An answer
PayPal Gateway not configured
PayPal Gateway not configured