s ravi chandran wrote:won't the string abject also be counted?
It would also be initialized to default null, right? hence, it should also be counted.
First, since the object of class test itself has not been made.. There is no point in counting String abc for object creation..
Second, even if we make object of class test, and String abc is initialized to default value null.. It is not creating an object of type String..
Because, String abc = null, simply means a null reference .. So no object created..
Ya. That would be right. I am getting dumber with age. One small doubt, suppose I keep the main method blank, and run the class. It would create the object of that class, right? Even though it won't run the main thread as main is empty body.