Initializing Fields
| |||
Fields can (and often should) be initialized when they're declared, just like local variables.
The next program creates a new car and prints it:
For example, % javac Car.java % javac CarTest.java % java CarTest is moving at 0.0 kilometers per hour. | |||
|