Skip to content
Advertisement

How to create an object of subclass in java?

I am trying to create an object of subclass which is not static in the main, but not able to do. Does anyone tried the same?

JavaScript

Advertisement

Answer

JavaScript

or in your case

JavaScript

You need the instance of the parent class to create instance of inner non-static class.

Advertisement