Question: java programming please Test 2(12 points) Classes and Objects. Read codes and answer questions. // MyClass.java package ch.zjnu.exams; public class MyClass { private int count;

Test 2(12 points) Classes and Objects. Read codes and answer questions. // MyClass.java package ch.zjnu.exams; public class MyClass { private int count; String info; public static String message = "Good"; public Myclass increase() { count++; 1/return the current object 1/3 private MyClass() { this.count=8; this.info - "GoodLuck"; public int getCount() { return count; } public static MyClass getInstance() { // Create and return the object of MyClass 2 } } //TestMyClass.java package cn.zjnu.exams; public class TestMyClass { public static void main(String[] args) { MyClass mci - MyClass.getInstance(); Myclass mc2 - MyClass.getInstance(); mc1.message - "Great"; mc2. message = "Excellent"; MyClass.message - "Nice"; System.out.println(nci.message+ :*+mc2. message":"#MyClass.message);// 3.1 System.out.println(mc1.info-mc2.info); //3.2 mc2.info = new String("GoodLuck"); System.out.println(mci.info--mc2.info); //3.3 System.out.println(mci.info.equals(mc2. info)); System.out.println(mci. increase().increase().getCount();//3.4 3 } Questions: 1 2) 3) What is the output of the code? Explain the reason. 3.1 3.2 3.3 3.4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
