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
Can finally block be used without a catch?
How to read and write image from a file ?
What are different access specifiers in java?
What is ide with example?
If try block is successfully executed, Then Is Finally block executed?
Java Compiler is stored in JDK, JRE or JVM?
How do you convert an int to a double in java?
What does mean in regex?
Can we create our own wrapper class in java?
Explain the Propertie sof class?
can rmi and corba based applications interact ?
What is javac_g?
What are the different types of collections in java?
What is return data type?
What do you mean by jjs in java8?