This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
My Question what is the difference between line no. 6 & 7.I mean both are working what is the purpose of the using final in line 6. please let me know.
Thanks in Advance.
Ivan Vrtacnik
Greenhorn
Joined: Sep 02, 2008
Posts: 26
posted
0
Final is a keyword that is relevant to inheritance, not behaviour of the variable in the given class.
It means that the final variable cannot be inherited by children of this class.
Ganeshkumar cheekati
Ranch Hand
Joined: Oct 13, 2008
Posts: 362
posted
0
you can modify the status of the object which you created in line 6 eventhough you are using final keyword.
the main use of final is you cannot use that reference variable to point to another object.that means reference can not be changed.
Ivan Vrtacnik ---- Final is a keyword that is relevant to inheritance, not behaviour of the variable in the given class.
Inheritance has nothing to do with the given code. Reference variable "test" is local to main method. Here it means you cannot assign any object to "test" reference variable. But you can do this later in the code...
but not with test reference because it's final and you cannot re-assign anything to it once you assign an object this case .