What are the limitations for static method?
Answer Posted / puneet
Static in context of java is something which is executed at
the time when the class is loaded by either bootstrap loader
or another loader into memory.These are basically for
initializations of the variables which wil be used by all
the instance variables.Say we need ot restrict how many
objects whill be created of the class store the no.of
objects created in a static variable and everytime the
object is called thestatic variable is incremented and as
soon as it reaches a limit restrict it by some logic.
The static methods can be called by the object refrence of
the class or the class name, they cannot use instance
variables or instance methods, they are the part of the
class and not instance, the static variables are stored in
registers and remain in the memory as long as the clas in
unloaded.
| Is This Answer Correct ? | 10 Yes | 10 No |
Post New Answer View All Answers
What is finalize method?
Is arraylist dynamic in java?
Tell some latest versions in JAVA related areas?
Explain about join() method?
what is mutual exclusion? : Java thread
Does garbage collection occur in permanent generation space in jvm?
What do you understand by access specifiers in Java?
What are the important methods of java exception class?
How do you do a line break in java?
Is zero a positive integer?
How to create a thread in java?
How do you declare an empty string?
What is the type of lambda expression?
How many bytes is a string java?
What is maximum size of arraylist in java?