What is static variable and static method?
Answer Posted / aditya
static variables are class variables.They are globally
declared with the keyword "static".They can be intialised at
the declaration time (or) they can be initialised in static
block.They can accessed by using thier class name
(class name.static variable name).Static variables can also
be accessed by the obj name but to make the difference
between the instance variables and static variables they are
accessed using class name outside the class.Static methods
are the methods that can access only static variables,they
can access instance variables also but only through the
object of the instance variables not directly.Their values
are stored in heap memory.Any changes to the static
variables reflect in heap memory.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does business logic mean?
What are the major drawbacks of external iteration?
What are encapsulation, inheritance and polymorphism?
What is the finalize method do?
Explain java coding standards for classes or java coding conventions for classes?
make a method which any number and any type of argument and print sum of that arguments.....
What are the two types of exceptions in java? Which are the differences between them?
What is classpath?
What is method overloading in JAVA? Why is it not present in C ?
What does super keyword do?
Explain covariant method overriding in java.
Explain reverse a linked list iterative solution in java?
Can we use this () and super () in a method?
How many threads can I run java?
how is final different from finally and finalize in java?