Is it possible to define a function within a function in Java? I am trying to do something like:
public static boolean fun1()
{
static void fun2()
{
body of function.
}
fun();
return returnValue;
}
but I am getting error Illegal start of expression.
You cannot (and in Java they are called methods).
You can, however, define an anonymous class inside of a method, and call its methods.