Question: answer question use object oriented programmng in java. please provide explanation for the answer. QUESTION 2 Consider the following test class, Testclassi. public class TestClassi

answer question use object oriented programmng in java.

please provide explanation for the answer.

answer question use object oriented programmng in java. please provide explanation for

QUESTION 2 Consider the following test class, Testclassi. public class TestClassi public static void main(String[] args) int x = 6; Class1 cl - new classi(x); cl.disp(); // n = 6 cl.setN(-5); System.out.println(cl); // n = -5 if (cl.is Negodd()) System.out.println(cl.get()+": a negative odd integer"); else System.out.println(el.getN()+":not a negative odd integer"); // -5:a negative odd integer } a) State the category of the methods below: i. setN() ii. isNegodd () iii. disp) iv. getN) (2 marks) b) Write a method definition of isNegodd(). (3 marks) c) Write a toString() method to produce the same output as disp(). (3 marks) d) Write a complete class implementation of class1. (7 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!