What are the limitations for static method?
Answers were Sorted based on User's Feedback
Answer / vijayakumar chinnasamy
Static Method:
a. Access only static type data (static type instance
variable).
b. Call only static method ,if non-static then compile
time error.
c.No need the class object to call the static method.
d.Cant use this and super keyword otherwise compile time
error.
| Is This Answer Correct ? | 50 Yes | 4 No |
cdan not be reffered to this or super
can only access static data
can only call other static methods
| Is This Answer Correct ? | 26 Yes | 4 No |
Answer / 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 |
What is anagram of a string?
What does it mean to flush a file?
What do you mean by light weight and heavy weight components?
What's the difference between comparison done by equals method and == operator?
when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)dopost() d)service
What is the purpose of the file class in java programming?
Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?
Give some features of interface?
When we serialize an object does the serialization mechanism saves its references too?
What is java and its types?
What is Enum in Java?
What does .equals do in java?