Write a class with a legal name of your choosing. Your class…
Write a class with a legal name of your choosing. Your class should satisfy the following requirements: Have only one constructor that takes no arguments. Have a field that holds a count of how many instances of the class (i.e. objects) have been created. This field should be shared among all instances. Use proper encapsulation The object count should not be mutable from outside the class. A single accessor method should be written to retrieve the object count. No other methods are required. Make sure to select the ‘Preformatted’ style from the dropdown so your code is formatted clearly. DO NOT USE THE TAB KEY WHEN WRITING CODE AS YOU MAY ACCIDENTALLY SUBMIT YOUR EXAM. USE THE SPACE BAR INSTEAD.