Question: Static Variables & Methods Create a class called aThing with a blank constructor Create a static variable called numberOfThings in the class, which is incremented

  1. Static Variables & Methods
    1. Create a class called aThing with a blank constructor
    2. Create a static variable called numberOfThings in the class, which is incremented each time an instance of aThing is created
    3. Create a static method in aThing thats sole purpose is to print the current value of numberOfThings. Call it TotalOfThings
    4. Instantiate four instances of aThing and invoke TotalOfThings from main()

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!