In the first case, You can call all the methods which are defined in JFrame only, but you can not call any method is which is added in SomeClass. Because parent class does not know what has been added in its child class. In the second case, you can call all the methods of SomeClass and all the methods inherited from its parent class JFrame. Hope it is clear. Cheers,
The advantage of the first style is that you can switch from SomeClass to a different implementation by just changing the instantiation - you *know* that all the code just needs a subclass of JFrame. The disadvantage is, of course, that all the code can only use methods defined by JFrame. My advice would be to go with the first approach as long as you can. That is, always code to the least specific interface possible.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
subject: Difference between calling an object in 2 ways(please read for more info)