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 an arraylist c++?
What is #include iostream h in c++?
Does c++ support exception handling?
Write a program in c++ to print the numbers from n to n2 except 5 and its multiples
program explaining feautures of c++
How do you remove an element from a set in c++?
How should runtime errors be handled in c++?
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
What is the basic of c++?
Define whitespace in C++.
Why do we need constructors in c++?
What are disadvantages of pointers?
What is the iunknown interface?
Please explain class & object in c++?
What are the various oops concepts in c++?