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 are the advantages of early binding?
What is difference between c++ 11 and c++ 14?
Which bit wise operator is suitable for turning off a particular bit in a number?
What is microsoft c++ redistributable?
What is the purpose of template?
What is microsoft c++ redistributable 2013?
What is c++ programming language?
Define virtual constructor.
What do you mean by global variables?
You run a shell on unix system. How would you tell which shell are you running?
Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list
What is data structure in c++?
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()
Are there any special rules about inlining?
What are formatting flags in ios class?