NPTEL Programming in Java Week2 Assignment-2 Solutions 2021 | Swayam


 

Week-2

Assignment -2

=================================

Ans of Question - 1

Student OBJ2=new Student();

OBJ2.print();

Student OBJ3=new Student();

OBJ3.print();

 

Ans of Question - 2

Printer OBJ2=new Printer();

OBJ2.print("Hi! I am class STUDENT ");

OBJ2.print();

 

Ans of Question - 3

void studentMethod(){

print(this);

}

 

Ans of Question - 4

class Answer

{

     Answer()

      {

             System.out.println("You got nothing. ");

      }

      Answer(int mark,String type)

      {

             this();

             System.out.println("You got "+marks+ " for an "+type);

      }

 }

Ans of Question - 5

String nptel,space,java;

Nptel= "NPTEL ";

Space= " ";         

Java= "JAVA ";


No comments:

Powered by Blogger.