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

can i call a consturctor from a static method?

 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the format for calling a constructor ?
can i call a constructor from a non-static method ?
can i call a constructor from a static method or block?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of those questions that can be answered by testing it yourself.
If I answer the first question for you:

You should be able to discover the answers to the other two questions yourself.
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Along with those,

try,

1) Static block
2) Object block ( which will be executed before constructor)

They will give good insight into object state loading.
 
Ken Blair
Ranch Hand
Posts: 1078
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srinivas Kalvala:
Hello,

Along with those,

try,

1) Static block
2) Object block ( which will be executed before constructor)

They will give good insight into object state loading.


I don't see how. By "object block" are you referring to an instance initializer?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the beginners forum...
 
Dana Bothner-By
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by saikrishna cinux:
what is the format for calling a constructor ?


You've entered more than 400 posts and you haven't created an object yet? Just what have you been doing?
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ken Blair:

I don't see how. By "object block" are you referring to an instance initializer?



Yes Ken, you are Right.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic