Answer Posted / ranganathkini
Variables declared outside any method/constructor but inside
the class block, is a field variable.
Variables that are declared within a method or a specific
block of statements are local variables.
Local variables are kept alive as long as the execution is
within the block they're defined in. Once the block is
exited, the local variables can no more be used.
Field variables have longer life than local variables in
that they can live as long as the instance they belong to is
active.
Is This Answer Correct ? | 30 Yes | 4 No |
Post New Answer View All Answers
Give an example of use of pointers in java class.
Can we override final method?
How we can skip finally block of exception even if some exception occurs in the exception block in java?
what is ststic with example
What is one third plus one third as a fraction?
What is the static keyword?
What are the two ways of implementing multi-threading in java?
Explain how can you debug the Java code?
List down the methods and interfaces of collection class in java.
What is charat ()?
How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?
How to sort an array in java without using sort method?
Explain public static void main(string args[]) in java.
What are the differences between path and classpath variables?
How to declare an arraylist in java?