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
Why do we need autoboxing in java?
How do you check if an arraylist is not empty?
How does a for loop work java?
What does microservices mean?
What is cr keyboard?
How to reverse a string in java?
What is singleton math?
How can I become a good programmer?
What's the difference between comparison done by equals method and == operator?
If try block is successfully executed, Then Is Finally block executed?
What are thread safe functions?
What is the difference between compiler and jvm?
Does list maintain insertion order java?
Which object oriented concept is achieved by using overloading and overriding?
What is the method to expand and collapse nodes in a jtree?