This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need of static constructor

 
shukla raghav
Ranch Hand
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why would we ever need a static constructor. what does it mean by a static constructor ?

static refers to "not associated with specific object" and can be called using class reference rather than object reference. But how does this apply to a constructor
 
shukla raghav
Ranch Hand
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i got constructors are not static...
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never heard of a "static constructor". A constructor has an access modifier (public/private/protected/---) the name of the class and (parameters). You never write static.
 
Embla Tingeling
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shukla raghav wrote:why would we ever need a static constructor. what does it mean by a static constructor ?

static refers to "not associated with specific object" and can be called using class reference rather than object reference. But how does this apply to a constructor


The closest you come to a static constructor is a static initializer. It works like a static default constructor would work if it existed.

 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It never occurred to me that could mean initialisers. Well caught, uj.
 
Muhammad Khojaye
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also discuss here
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for noticing the old thread.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic