“HAPPINESS SHOULD BE A FUNCTION WITHOUT ANY PARAMETERS”

NPTEL (14 Sep - 04 Dec ) | Week 4 : Program 5 Programming in JAVA Solutions 2020.

 



        Programming in JAVA.       




FOR Q3 AND Q4 CODE CLICK HERE 


Java Week 4: Q5

Modify the code segment to print the following output.

-----------------OUTPUT-------------------
Circle: This is Shape1
Circle: This is Shape2
-------------------------------------------------

PROGRAM:


interface ShapeX {
 public String base = "This is Shape1";
 public void display1();
}


interface ShapeY extends ShapeX {
 public String base = "This is Shape2";
 public void display2();
}


class ShapeG implements ShapeY {
 public String base = "This is Shape3";
 public void display1() {
  System.out.println("Circle: " + ShapeX.base);
 }
 
  public void display2(){
  System.out.println("Circle: " + ShapeY.base);
  }
}


  WEEK-4 :Programming in JAVA
<<CLICK HERE FOR  WEEK 4:Quiz Assignment 4>> 
PLEASE SUBSCRIBE OUR CHANNEL.

FOLLOW OUR WEBSITE FROM THE BUTTON PROVIDED TO THE BOTTOM OF PAGE TO GET SOON ANSWERS OF PROGRAMS.
Disclaimer: Here you can find all nptel assignment solutions related to CS stream.These may help you for your assignment.The answers are only for verification.You cannot copy these directly from the post(code of conduct of NPTEL).These is not 100%  correct solutions.

No comments:

Post a comment

If you have any problems related to solutions or any concept please let me know.