what is difference between static and non-static variables
Answer Posted / mahesh_b.tech@2008
Non-static variables:
Instance block can be executed automatically when you were
creating the object.
Instance variables can be called by using with the object.
Instance variables can not called by using the class name.
memory will be alocated for instanse variables when you
create the object.
Static variables:
static block will be executed automatically when jvm(Java
Virtual Machine)loading the class into memory.
static varisble can be called using both objectname&class
name.
memory will be allocated when jvm loads the class.
| Is This Answer Correct ? | 13 Yes | 4 No |
Post New Answer View All Answers
What is the difference between set and map in c++?
What is c++ redistributable?
Is atoi safe?
What is an incomplete type in c++?
Comment on local and global scope of a variable.
Can recursive program be written in C++?
What is the use of endl?
What is string in c++ programming?
Explain terminate() function?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
Define macro.
What gives the current position of the put pointer?
Explain the properties and principles of oop.
What is data type in c++?
What is static class data?