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
Who was the creator of c++?
What is bubble sort c++?
Will rust take over c++?
What is do..while loops structure?
total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.
What data encapsulation is in c++?
Can we use this pointer in a class specific, operator-overloading function for new operator?
What is the difference between cin.read() and cin.getline()?
Is map sorted c++?
Can a new be used in place of old mallocq? If yes, why?
What is the difference between public and private data members?
What are the advantages of prototyping?
How do you declare A pointer to a function which receives nothing and returns nothing
What is the main function c++?
What do you mean by persistent and non persistent objects?