wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Why cant final, synchronised keyword's cannot be used with constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why cant final, synchronised keyword Watch "Why cant final, synchronised keyword New topic
Author

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

Satish Kota
Ranch Hand

Joined: Feb 08, 2006
Posts: 88
Why cant a constructor be final ?

why cant a constructor be synchronised?


SCJP 5.0 77%
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
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?


Tony Morris
Java Q&A (FAQ, Trivia)
 
 
subject: Why cant final, synchronised keyword's cannot be used with constructors
 
Similar Threads
Constructor cant be final
Why cant a volatile variable final?
final static variable
Final Keyword
final & static Constructor