:confused: Write a class, which can be instantiated at most 100 times.
If an attempt is made to instantiate it after 100 instances have been created, the constructor should throw an exception. It should also have a toString method which returns the position of the object in the sequence of instantiations.
how can we set the limit 100?
what is the 'position of the object in the sequence of instantiations'?
Make the default constructor private! and create a static method named createObject() which returns the object created. Inside this method, you can write an if sentence to limit number of objects created..