What is static variable and static method?
Answer Posted / abanish kumar rajoot
Static Varaibles & methods both are, class level
declaration means of it ,static varaibles are those which
are common for all the objects and the advantage of static
varaible over non-static is that they allocate memory space
at complitaion time means when a class gets load in memory.
and they remains in memory till class is loaded there.
Static methods are declared with static keyword and they
can be accessed by class name and only accessed static
variables.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are assembly attributes?
What's the access scope of protected access specifier?
What is meant by 'Class access modifiers'?
when you will synchronize a piece of your code? : Java thread
Can we write class inside a class in java?
What is a memory leak in java?
What are the super most classes for all the streams?
What is the meaning of flag day?
How to convert string to byte array and vice versa?
What are static variables and functions?
What is mean by collections in java?
Does sprintf allocate memory?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?
Is singleton a bad practice?
Can we sort arraylist in java?