The method "method" is defined inside the method "main". You can't do that; move all of "method" outside of the body of "main". You'd have to move "str" out to the body of the class so that "method" could see it, make "str" and "method" static so that "main" can see it, and then call mehtod() from main. Altogether, it could look something like:
Chitta Ranjan Mahato wrote:You can not call a method within a method
I think you mean that you can not declare a method directly* within another method. It's certainly possible to call another method though. This is probably just a linguistic misunderstanding, but I think it's important to correct in this case.
declaring a method != calling a method
* It's possible to declare an inner class within a method, and then declare another method within that inner class. But that's a more advanced topic, and not what the original poster was doing.
I see David has already posted as much while I was dealing with posting problems. Oh well - I hope the added detail here may help some.