Creativity is nothing but Breaking Rules
santhosh.R gowda wrote:... we cant override that method bcz we cant extending the class ...
santhosh.R gowda wrote:Dear All
As we know if we make class final the class cant be extend by another class
so my question is if we make class final what is the use of making methods final even though we cant override that method because we cant extending the class
so why in java API String methods are final
Creativity is nothing but Breaking Rules
[My Blog]
All roads lead to JavaRanch
santhosh.R gowda wrote:Dear James
Please can you explain your answer more clearly...
santhosh.R gowda wrote:Dear All
As we know if we make class final the class cant be extend by another class
so my question is if we make class final what is the use of making methods final even though we cant override that method because we cant extending the class
so why in java API String methods are final
OCPJP 6
That practice is discussed in this thread, where you find out its correct nameVinoth Kumar Kannan wrote: . . . make a getter method for the same that will return a new instance of that mutable object - just to make sure your Object is never changed at all. . . .
OCPJP 6
OCPJP 6
crispy bacon. crispy tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|