Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the process if i make a object as static?

 
senthil sen
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the process if i make a object as static?
can i do this?
when i make a constructor as static a object for that call becomes static..
so what happens to to the instance variables?
what are the advantages of this design and its disadvantage?
Is this kind of a design used often?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A constructor can not be static.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And an object can't be static, too. I wouldn't even know what it would mean for an object to be static...
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The word "static" is used because it means "resolved at compile time" (as in NOT dynamic like polymorphism is).
Please be aware that a variable is NOT "equivalent" to an object. The variable can be static, that does not mean that the object that it references is static.
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the process if i make a object as static?

There is a big difference between an object and a class...
can i do this?

Basically, as said before: No way!
Is this kind of a design used often?

As it's not possible to have this design, it would lead to the conclusion that this design is not used very often
Erik
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you take a look at this:
http://java.sun.com/docs/books/tutorial/java/concepts/index.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic