NPTEL Programming In Java Week 4 Assignment Solution

preview_player
Показать описание
NPTEL Programming In Java Week 4 Assignment Solution. It includes the week 4 Programming assignment only.
Рекомендации по теме
Комментарии
Автор

Not all heroes wear capes....some record their screen too.

udayjuneja
Автор

for 3rd question as it is interface we should not define the method in it ....so im giving my solution to that without defining the display method in interface itself;




interface ExtraLarge{
String extra = "This is extra-large";
public void display();
}

class Large {
public void Print() {
System.out.println("This is large");
}
}

class Medium extends Large {
public void Print() {
super.Print();
System.out.println("This is medium");
}
}
class Small extends Medium {
public void Print() {
super.Print(); ;
System.out.println("This is small");
}
}


class Question43 implements ExtraLarge{
public void display(){
System.out.println(extra);
}
public static void main(String[] args) {
Small s = new Small();
s.Print();
Question43 q = new Question43();
q.display();

}
}

AmanKumar-jtzb
Автор

For 2nd Program:

// Create an object of Calendar class.

Java.util.Calendar current;

//Use getInstance() method to initialize the calendar object

current =

//initialize the int variable year with the current year

year =

HMD_MSRF_K
Автор

Hello all,
In question no 2 Change the object name from cal to current for fixing compilation error. Apologize

ayushtake
visit shbcf.ru