This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes what is the process if i make a object as static? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "what is the process if i make a object as static?" Watch "what is the process if i make a object as static?" New topic
Author

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

senthil sen
Ranch Hand

Joined: Oct 10, 2002
Posts: 184
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

Joined: May 05, 2000
Posts: 13974
A constructor can not be static.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
And an object can't be static, too. I wouldn't even know what it would mean for an object to be static...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
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.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Erik Pragt
Ranch Hand

Joined: Sep 08, 2001
Posts: 125
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

Joined: Sep 08, 2001
Posts: 125
I suggest you take a look at this:
http://java.sun.com/docs/books/tutorial/java/concepts/index.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what is the process if i make a object as static?
 
Similar Threads
K&B Ch. 5: Q on constructors & instantiation
Should I use objects or not???
static methods
Does the model contain the solution?
A protected static question