Is the following code written correctly? Justify youranswer. [0.25]
class A
{
//Class A
}
interface B extends A
{
//Interface Bextending Class A
}
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());
}
}
Expert Answer
An
PayPal Gateway not configured
PayPal Gateway not configured