A newbie in OOP program

B

Bruce Sam

I know the static variable in java will create an instance not
object.But I am a newbie in OOP program.Could you tell me the different
between the object and instance?Thanks very much.
 
K

klynn47

Actually a static variable in a class definition is allocated space in
memory when the class definition is loaded into memory for execution.
There is only one copy of a static variable no matter how many
instances we create. New instances of the class definition receive
their own copies of all of the instance variables.
 
J

jeffc

Bruce Sam said:
I know the static variable in java will create an instance not
object.

That's not true.
But I am a newbie in OOP program.Could you tell me the different
between the object and instance?Thanks very much.

There is no difference. You're confused about terminology.
 
D

dingo

look to an object like a advanced bleuprint of a house. (your class )
an instance is the house you construct. so you can construct 1,2,3 .... or
and even more houses.
object house1 = new object()

an object variable could be the number of times you have contruct a house
(that you write on the bleuprint ). --> object.count
house1.count is the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top