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 the name of java compiler?

494


What is j2ee api?

529


Is eclipse written in java?

549


What is j2ee tutorial?

512


What is java 2 platform, micro edition (j2me)?

521






What is button in java?

498


what is meant by proxy server

4179


What is java secure socket extension (jsse)?

519


What is architecture neutral in java?

491


Why is java called object oriented?

518


I am newbie in J2EE & looking for strong basic behind each concept as, Why do we use private access specifier before each variable of type property bcoz ultimately to access it outside the class we use public method as getter & setter ? If we use getter & setter to access it outside the class so better we make variable as public so that it is easily available outside of the class... Please guide me why do we use as private ????

5017


What is java actionlistener?

480


What are defined as web components?

517


What is the difference between session bean and entity bean ?

487


What is java api for xml-based rpc (jax-rpc)?

533