tag:blogger.com,1999:blog-4435599137875974089.post1978134318107507540..comments2024-03-29T11:33:35.996+05:30Comments on Coding Chronicles: final - Least used keyword in Java development?Unknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4435599137875974089.post-81009483175358312332011-07-17T09:31:10.236+05:302011-07-17T09:31:10.236+05:30This should be the most used keyword in Java :) be...This should be the most used keyword in Java :) because it makes life easier specially if you are writing multi-threaded high performance concurrent code.<br /><br />Javin<br /><a href="http://javarevisited.blogspot.com/2011/04/synchronization-in-java-synchronized.html" rel="nofollow">What is synchronization in Java</a>Javin @ grep command in unix with exampleshttp://javarevisited.blogspot.com/2011/06/10-examples-of-grep-command-in-unix-and.htmlnoreply@blogger.comtag:blogger.com,1999:blog-4435599137875974089.post-25474933175507760862007-05-24T23:57:00.000+05:302007-05-24T23:57:00.000+05:30Performance was always a terrible reason for using...Performance was always a terrible reason for using final and a moot point these days. I've needed to override pieces of libraries and been completely stuck because all their parameter types are final classes. <BR/><BR/>I hadn't thought about it as a way of enforcing composition (as mentioned in your link) but that's about the only good reason I can think of for using it in an app - just make sure there is a corresponding interface.Scott Vachalekhttps://www.blogger.com/profile/16657240494706707555noreply@blogger.comtag:blogger.com,1999:blog-4435599137875974089.post-42318095045365627012007-05-24T14:44:00.000+05:302007-05-24T14:44:00.000+05:30@DanI guess the proper title would have been 'most...@Dan<BR/><BR/>I guess the proper title would have been 'most under used keyword'. You are probably spot on about the least used keywords.MEWGhttps://www.blogger.com/profile/02846977719322642589noreply@blogger.comtag:blogger.com,1999:blog-4435599137875974089.post-77551908042198462482007-05-24T06:36:00.000+05:302007-05-24T06:36:00.000+05:30final on method and classes doesn't actually make ...final on method and classes doesn't actually make any difference on a modern JVM (well, perhaps on Java ME VMs). Sun HotSpot, for instance, after verification only uses it when compiling to short circuit a check to see whether there are subclasses the override - the same code is generated whichever. <BR/><BR/>final on fields is a must, where ever possible. It's not necessarily a bad idea of local variables.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4435599137875974089.post-26598461672059385832007-05-24T03:34:00.000+05:302007-05-24T03:34:00.000+05:30I'd say that final is probably one of the most use...I'd say that final is probably one of the most used keywords, certainly in my own code.<BR/><BR/>Always make each field of a class final unless you have a good reason not to.<BR/><BR/>Final classes and methods are less straightforward. It depends on how you intend the class to be used.<BR/><BR/>As for the least used keyword in Java, that has to be 'strictfp', probably followed by 'volatile' and 'transient'. Personally I've never used 'continue'.Anonymousnoreply@blogger.com