Java ' final' keyword
Eliza Berthman last edited by admin
When I have declared instance variable x as final then why its not showing an error when I used x variable again in Add() method although it has been declared as final ? ?
Aman Srivastava last edited by
Firstly I would like to highlight the fact that global and local variables CAN have same names however its not usually a good practice. Coming to the point this is a case of accessibility. You are having same names of variable but only the local variable is accessible in the Add() method so you are not getting any error.