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 constructor in C++?
What is math h in c++?
Can we run c program in turbo c++?
What is buffering in c++?
Is set c++?
What is general form of pure virtual function? Explain?
Do you know the problem with overriding functions?
What is the difference between *p++ and (*p)++ ?
Which sort does c++ use?
What is a rooted hierarchy?
When is dynamic checking necessary?
What are the basics of local (auto) objects?
Difference between a copy constructor and an assignment operator.
How should a contructor handle a failure?
How can you quickly find the number of elements stored in a dynamic array?