Can you have an inner class inside a method and what variables can you access?- | Eklavya Online

Can you have an inner class inside a method and what variables can you access?-

?– Yes, we can have an inner class inside a method and final variables can be accessed.