• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A constructor can not be static.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest you take a look at this:
http://java.sun.com/docs/books/tutorial/java/concepts/index.html
 
He baked a muffin that stole my car! And this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic