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 meant by string pooling?

12 Answers   Oracle, Polaris, Tribal Fusion, Wipro,


How do you start a new line in java?

0 Answers  


What do you understand by final value?

0 Answers  


What is independent and dependent variables in research?

0 Answers  


any other way to print the text without using System.out.println() in java?

5 Answers   IBM, Infosys,






What is the difference between length and length () in java?

0 Answers  


Why java is said to be pass-by-value ?

0 Answers  


In java, how many ways you can take input from the console?

0 Answers  


why are there separate wait and sleep methods? : Java thread

0 Answers  


What is empty string literal in java?

0 Answers  


What are the basic control structures?

0 Answers  


how many types of Inheritance?

0 Answers   Impetus,


Categories