Last active
December 19, 2018 14:55
-
-
Save dharmayejju/d4fbe1209f7dd2c072378998f424198f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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