Question: Exercise 1 (10 marks) (Exl.java) A. Complete the class Myclass. public class MxClass { private int x; private static int count: MyClass { l/initialize x

 Exercise 1 (10 marks) (Exl.java) A. Complete the class Myclass. publicclass MxClass { private int x; private static int count: MyClass {

Exercise 1 (10 marks) (Exl.java) A. Complete the class Myclass. public class MxClass { private int x; private static int count: MyClass { l/initialize x to 0 } MxClass(int a) { // initalize x to a } SeX( int a) { } printXO { } ...public static printCounto { } incrementCounto { }} a. Write the main program to test this class b. Declare myObject1 to be a MxClass object and initialize its instance variable x to 0. C. Declare myObject2 to be a MxClass Object and initialize its instance variable x to 7. B. Use java comments to write the answers of the following questions: a. Which of the following statement are valid? i myObject1.printCount(); ii. myObject1.printX(); 111. My Class.printCounto: iv. MxClass.printxo: V. MxClass.count++; b. What the output of the following? i. myObject1.printX0; ii. myObject1.incrementCount(); myObject1.printCount(); myObject2.printCount(): 111. MxClass.incrementCountO; myObject1.printCount(); myObject2.printCount(): iv. myObject2.incrementCount(); myObject1.printCount():myObject2.printCounto: V. myObject1.setX(19); myObject1.printX0;myObject2.printxo

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!