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


Please Help Members By Posting Answers For Below Questions

What is the program compilation process?

584


How many bytes are there?

540


What are the different collection views provided by maps?

566


Can an interface extend a class?

540


How many bytes is a string?

559






Is null a value?

561


define the terminology association.

617


What’s the difference between the methods sleep() and wait()?

541


Can you override a final method?

579


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

626


What are the different http methods?

531


What are the differences between include directive and include action?

545


What is navigable map in java?

521


How do you do math powers in java?

575


Can we make the abstract methods static in java?

587