+ 4
Declaration of a method inside another
can we declare a method inside another method?
4 Answers
+ 19
U cannot define a method inside a method in JAVA but what U can do is to make method call() to another method or same method inside a method
//thats why recursion works
+ 17
Using lambdas!! See thisđ
https://stackoverflow.com/questions/7367714/nested-functions-in-java/
+ 4
No, that would be illegal. The closest you can get are anonymous inner classes:
https://stackoverflow.com/questions/355167/how-are-anonymous-inner-classes-used-in-java
+ 2
No it will generate a error because methods cannot be nested. they are defined separately and compile together.