tag:blogger.com,1999:blog-8712770457197348465.post693625356624769832..comments2024-03-28T02:47:19.159-07:00Comments on Javarevisited: When to make a method final in Java? Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-8712770457197348465.post-56998015205707524992019-01-10T14:25:46.479-08:002019-01-10T14:25:46.479-08:00Thanks for heads=up, *Change* was missing there, a...Thanks for heads=up, *Change* was missing there, added now. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-8039976962739042682019-01-10T07:09:01.742-08:002019-01-10T07:09:01.742-08:00Just a heads up, you have a little grammar mistake...Just a heads up, you have a little grammar mistake in the 5th paragraph: "but also ensures that no one can it's definition"Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-48237069203076676502016-07-24T04:23:24.753-07:002016-07-24T04:23:24.753-07:00their is another reason which is why I suggest you...their is another reason which is why I suggest you always use final<br /><br />nothing to do with Java itself more developer productivity and reducing bugs, specifically due to when working with source control and merging code, or applying patches<br /><br />if you use final all the time it will break the compile time build after its merged and built. if variables are reused so this highlights Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-27178315743178957442015-01-12T18:38:08.141-08:002015-01-12T18:38:08.141-08:00I was asked in a interview that when to use final ...I was asked in a interview that when to use final method in Java and when I gave example of template method pattern, interviewer asked me that it's better to make the template method private than final, because making it private, makes it final anyways but also hide it from outside world, unlike final which doesn't hide it. So now my question is what is different between private and finalKabirnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-83473483376624229992014-03-22T21:28:47.116-07:002014-03-22T21:28:47.116-07:00@Javin Nice article just want to add that..
Final...@Javin Nice article just want to add that..<br /><br />Final keyword has a numerous way to use:<br /><br />A final class cannot be subclassed.<br />A final method cannot be overridden by subclasses<br />A final variable can only be initialized once<br />Other usage:<br /><br />When an anonymous inner class is defined within the body of a method, all variables declared final in the scope of that SARAL SAXENAhttps://www.blogger.com/profile/01084233786047386880noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-87757578118349506002014-02-05T02:33:10.074-08:002014-02-05T02:33:10.074-08:00You must absolute make a method final if it is doi...You must absolute make a method final if it is doing any kind of security checks, because non-final method , who performs security checks can be overridden in a way that bypass security. For example, a child class can override a non-final method to bypass security checks done in the parent class. Following code is bad for this reason<br /><br />class SensitiveClass{<br /><br />public perform(Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-4655850673970554162013-12-04T09:02:10.694-08:002013-12-04T09:02:10.694-08:00can u share me ur knowledge of java performance an...can u share me ur knowledge of java performance and tuning with optimizer(how jvm working with bytecode with taking the consideration with performance ) it thr any article or books...ple lemme knw ...........Thnaks in advanceAnonymousnoreply@blogger.com