Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!

Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Java

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 11-16-2017, 01:50 AM   #1
sunled
Registered User
 
Join Date: Nov 2017
Posts: 2,175
Can you make a constructor final?

Can you make a constructor final?
sunled is offline   Reply With Quote

Old 12-11-2017, 08:39 PM   #2
travelowebseo
Registered User
 
Join Date: Sep 2017
Posts: 84
So making a constructor final is not required, so it is not used with constructor. When you set a method as final, it means : "You don't want any class override it", but constructor by JLS definition can't overridden,so it is clean. We can't make constructor to be final because constructor is never inherited.
travelowebseo is offline   Reply With Quote
Old 02-05-2018, 11:36 PM   #3
vishaljamdagni
Registered User
 
Join Date: Feb 2018
Location: Noida, India
Posts: 2
Hello there,
By marking a method final you're basically saying that this particular method can never be overriden. Now if you think about it you'll recognize that constructors aren't methods, so they can't be strictly speaking "inherited" which further means that they can never be overriden hence there is no requirement of making a constructor final because it already behaves like something which is marked final.
vishaljamdagni is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Build Your Own Solar Panels And Start To Make Free Energy fuqshenjie Search Engine Optimization 2 07-04-2017 02:14 AM
How can i make money via my website? Parfitt General Discussion 22 06-14-2017 09:16 AM
New Cycloramic iPhone App to Make Panoramic Videos abiabiah General Discussion 3 07-14-2015 09:46 AM
How can i make my nose permanently smaller with out surgery? dateline General Discussion 2 02-15-2014 01:16 AM
Discover How to Make Money Online Creating Your Own Niche Web Site. theshawnchin Making money on the web 1 12-31-2013 12:18 AM


All times are GMT -7. The time now is 05:47 PM.


Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.