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's a method in programming?
What is the difference between jdk, jre, and jvm?
How many decimal places is a double?
What is the importance of static variable?
What is the main advantage of passing argument by reference?
What are the legal operands of the instanceof operator?
What do you understand by synchronization?
Can we override private methods?
What is remote method invocation (rmi)?
What is byte code and why is it important to java’s use for internet programming?
What is rmi and steps involved in developing an rmi object?
Tell me a few examples of final classes defined in Java API?
What is an object class?
Can we print null in java?
How do you trim a space in java?