Yes it can be defined inside a method and it can access data of the enclosing methods or a formal parameter if it is final.