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
How to solve the problem of generating the unique hash keys with hash function?
What is dynamic binding(late binding)?
What happens to the Exception object after handling an exception?
What is the difference between class & object?
what is meant wrapper classes?
What are the rules for variable declaration?
What is meant by null and void?
How many bits is a string?
How can we access some class in another class in java?
What is an argument in java?
what is deadlock? : Java thread
Java Compiler is stored in JDK, JRE or JVM?
How many bits is a double?
Why is flag used in java?
What is meant by object oriented programming – oop?