static variable is a class variable which value remains
constant for the entire class?? variable means value is
changed....hear value is not changed... why it is called
static variable

Answer Posted / singh_prabhakar

its a misconception if u think tht static variable's values
are nt changed....it does....!!!
the keyword static only means tht this variable belongs to
the class ie every object tht uses this var is using the
only copy of it wch lies with the class......unlike the
instance variable where when accessed every object enjoys a
copy for itself...
in short --in a class thr's a - "static int k=0;" n class
has three objects -"ob1,ob2,ob3" n say all tends to
increment "+2" to the value of k...then @ end after being
accessed by aal three objects the final value of "k" wud be
"6" ..!!!
[ASSUME it like a JOINT ACCOUNT IN A BANK BETWEEN TWO
SIBLINGS...transactions made by any of them is Reflected in
the shared account..]

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is j2ee called now?

577


Is string an object in java?

534


What is container-managed transaction?

653


What is java api for xml registries (jaxr)?

625


What is distributed application?

608






What is the difference between java and core java?

572


What is caller?

628


What do you mean by the deployment descriptor?

580


What are the main components of the j2ee application?

548


What is java transaction api (jta)?

596


Is class a data type in java?

562


What are the advantages of object-relational mapping (orm)?

555


What is a j2ee component?

581


Is j2ee a programming language?

607


Describe the file types *.ear, * .jar and *.war?

578