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
Is an object null?
What is serialization in java?
What is meant by memory leak?
Explain wait() method of object class ?
What are the 8 data types in java?
What is difference between length and length() method in java ?
How can we use primitive data types as objects?
How do you define a variable?
What is singleton class example?
Can a hashset contain duplicates java?
Mention some features of java?
Why is stringbuffer faster than string?
What is downcasting?
What is a parameter used for?
Can we force garbage collector to run ?