JAVA Basic Notes
What is field in java?
Java fields are variables within Java classes. Both Java fields and methods have a type, or the type of data they contain (such as an int or double). A field is a member variable that belongs to a class.
Field Summary of Java System Class
| Modifier and type of field | Field | Description |
|---|---|---|
| static PrintStream | err | It is the standard error output stream |
| static InputStream | in | It is the standard input stream |
| static PrintStream | out | It is the standard output stream |
What is the difference between a field and a variable?
The difference is that a field affects everything in the class and every instance of that class. A variable affects only what’s in the method for which it is defined.