Can i return an object of the method local inner class created inside the same method. If yes, then how am I going to write the return type of the method which contains the class?
Ahh..!! Well Rohit..I do not think that we can do it..!! Feeling a little lazy to write code and check that..!! But I can try to give some excuse to validate point..!!
1) first of all at the time of method Declaration we don't know about the method~local~inner~class..we don't know even the name of the class..!! we don't know whether it exist or not..!! so how can we declare the return type of the same..!!
2) method~local~inner~class is local to method..even if we pass it outside..we wont be able to access the method define inside it..!! So there is no benefit..!!
3) What if we declare a method in an interface or abstract method..!! this is just like at the time of declaration we are forcing the implementing class to define a class..!! we can not do that..we can not say anything about method content at the time of declaration..all we can say what parameter it can accept..what it can return..!!
I am not sure about any point..!! This is my thinking process..!! I am out of excuses now.!!!
I think the only type that <something> could be is 'Object' or if the Local class extends or implements some known class or interface(i.e known outside the method) then you could easily return that type or cast to it later within main().