java:initializing_classes_and_constructors
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
java:constructor_basics [2020/09/12 04:58] – [Default constructors] mithat | java:constructor_basics [2020/09/12 05:00] – [Initializing member variables] mithat | ||
---|---|---|---|
Line 42: | Line 42: | ||
</ | </ | ||
- | upon instantiation, | + | upon instantiation, |
+ | |||
+ | One way to do this is to set initial values in the variable | ||
<code java> | <code java> | ||
Line 55: | Line 57: | ||
</ | </ | ||
- | With the above modification, | + | With the above modification, |
This approach works fine if your class is fairly simple. | This approach works fine if your class is fairly simple. |
java/initializing_classes_and_constructors.txt · Last modified: 2020/09/16 18:15 by mithat