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
What do you mean by static variable?
Can final class have constructor?
What defines function?
Can the garbage collection be forced by any means?
Can we have two main methods in a java class?
How to implement an arraylist in java?
What is bufferedreader in java?
How do you achieve singleton?
What is a private class in java?
Which object oriented concept is achieved by using overloading and overriding?
Tell some latest versions in JAVA related areas?
What is the purpose of methodology?
What is a java applet? What is an interface?
What is the private method modifier?
What is final access modifier in java?