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
Can you override a final method?
How does a for loop work java?
What is java beans?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
What is immutability in java?
Can Exception handling we can handle multiple catch blocks?
What does a za z0 9 mean?
What is the function of static in java?
What is the program development process?
What is collection class in java? List down its methods and interfaces.
What is the differences between heap and stack memory in java? Explain
What is the difference between double and float variables in java?
Is java free for businesses?
What is java in simple terms?
Can we define private and protected modifiers for variables in interfaces?