What are field variable and local variable?

Answers were Sorted based on User's Feedback



What are field variable and local variable?..

Answer / 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

What are field variable and local variable?..

Answer / monoranjan gorai

Field Variable is a member of a class whereas Local Variable is a member of a method.

Is This Answer Correct ?    4 Yes 3 No

What are field variable and local variable?..

Answer / ravikiran(aptech mumbai)

field variable is the one which can have different access
local variable access restict to method only

Is This Answer Correct ?    8 Yes 9 No

Post New Answer

More Core Java Interview Questions

What is a linkedhashmap java?

0 Answers  


What is bitwise complement?

0 Answers  


What is the difference between this() and super()?

15 Answers   TCS,


What is return used for in java?

0 Answers  


what is features of jdk 1.5?

2 Answers   Accenture, Satyam, TCS,






Which number is denoted by leading 0x or 0x in java?

0 Answers  


is it mandatory to deaclare all variables public static fianl in interfaces?if i declare like in the below program, public interface A { public static final int I=0; int j=0; } in interface A,what is the difference between I,j?

2 Answers  


Can a static method be overridden in java?

0 Answers  


What is the functionality of Webserver?

2 Answers  


What is java english?

0 Answers  


Justify your answer that you can't define a method inside another method in java, if you can then how?

0 Answers  


Can we declare register variable as global?

0 Answers  


Categories