Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why cant final, synchronised keyword's cannot be used with constructors

 
Satish Kota
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why cant a constructor be final ?

why cant a constructor be synchronised?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why cant a constructor be final ?

Constructors are not inherited, so it wouldn't make sense for a constructor to be declared final.

why cant a constructor be synchronised?

Because it makes no sense for constructors; it's never necessary. There will never be two threads constructing the same object.
 
Tony Morris
Ranch Hand
Posts: 1608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satish Kota:
Why cant a constructor be final ?

why cant a constructor be synchronised?


Assume they can be final and/or synchronized. Now, what exactly would it mean? It should be obvious if you have a clear understanding of what these keywords mean. Perhaps the existing definition of final and synchronized is unclear and you need to rephrase the question in this context?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic