Skip to content

Instantly share code, notes, and snippets.

@dharmayejju
Last active December 19, 2018 14:55
Show Gist options
  • Save dharmayejju/d4fbe1209f7dd2c072378998f424198f to your computer and use it in GitHub Desktop.
Save dharmayejju/d4fbe1209f7dd2c072378998f424198f to your computer and use it in GitHub Desktop.
Difference between "variable" and "field"
==========================================
Field: Defined in class
Variable: Defined in methods
Eg:
class Example{
void firstMethod(){
int myVar = 12;
myField = 42;
}
int myField = 0; P.S: field can be used before it is declared
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment