Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HELP NEEDED ASAP: Static objects exercise JAVA (please answer in java) CountObjects.java: ClassC: Exercise 4 Using Static Objects 1. Open and study class CountObjects.java. The
HELP NEEDED ASAP: Static objects exercise JAVA (please answer in java)
CountObjects.java:
ClassC:
Exercise 4 Using Static Objects 1. Open and study class CountObjects.java. The main method in this class creates a random number of objects of the class ClassC. However, variable numObjects has value -1, which you must change so that when this program is executed it prints the number of Class C objects created. 2. You can make changes to ClassC.java and to CountObjects.java. However, the only changes that you can make to ClasC.java are to the declaration of counter and changing the statement in the constructor of ClassC. Do not add more code to the constructor of ClassC. The only change that you can make in class CountObjects is the statement in line 9: numObjects = -1; you can assign to numObjects the number of objects that have been created. 3. Run your code and make sure that the value that it prints is the number of objects created and not - 1 (the number of these objects should be 16. Note that you cannot simply write numObjects = 16 in class CountObjects). zjqeu ] Jo Kdoo 20l u u jqe unoo i sseJou popeeso si jey pelqo KJn Eyi jnsu nok op MOH (Jojonysuo yl uJUwees yi inoys Moy 'os) pznox si Ozonsuoo z K ge e 0 njea y1 Seejuj pojejo selqo jo jequnu yi junoo of Ossejo upjejunoo ajqeuen sn jqoid nq n un s 1 2 public class CountObjects { 3 40 public static void main(String[] args) { 5 int numObjects; 06 Class C = null; 7 for (int i = 0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started