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 a hash function c++?
Define what is constructor?
What should main() return in c and c++?
Is eclipse good for c++?
Describe new operator and delete operator?
Explain how overloading takes place in c++?
What is meant by iomanip in c++?
Why c++ is called oop?
Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.
When should I use unitbuf flag?
Which software is used to run c++ program?
What are the advantages of c++?
What is singleton class in c++?
Differentiate between declaration and definition.
Define pointers?