What is the difference between static and non-static
variables?
Answer Posted / santosh mundhe
Static:1)Memory allocated before creation of object.
2)Gets memory on Global segment.
3)Object can't get copy of static variable, each
object shears static variable from global segment.
4)Static variables are not part ob object.
Non-static:
1)Gets memory on satck segment.
2)Object gets copy of non static variable.
3)Non static variables are part of object.
| Is This Answer Correct ? | 8 Yes | 7 No |
Post New Answer View All Answers
What is hashmap and map?
What is widening and narrowing in java? Discuss with an example.
Can we override tostring method in java?
What is serial version uid and its importance in java?
How does arraylist work in java?
Difference between process and thread?
What is an object’s lock and which object’s have locks?
Is integer a class?
what is heap memory?
What is return in java?
How do you declare a string variable?
What are inbuilt functions?
What does void * mean?
Difference between current previous versions of Java?
What access modifiers can be used for variables?