What was the difference between field and variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What was the difference between field and variable?

6th Sep 2016, 10:37 AM
Imran Bashir
Imran Bashir - avatar
1 Answer
+ 1
field : -field can be using access modifiers like public, private,protected. - no need to create instance of class to access static field. - it destroy when scope of class destroy. variable: -variable is a storage location. it is determine which type of value you store in variable. - its declared inside function. - it's destroyed when scope of function destroy.
25th Sep 2016, 5:50 AM
Vijay Makwana
Vijay Makwana - avatar