You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/ch_7_definingclasses.ptx
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -160,11 +160,11 @@
160
160
</program>
161
161
162
162
<p>
163
-
<idx>get</idx>
164
-
<idx>set</idx>
165
-
Direct access to instance variables is not allowed.
166
-
Therefore if we legitimately want to be able to access information such as the numerator or denominator for a particular fraction we must have getter methods.
167
-
It is very common programming practice to provide <term>get</term> and <term>set</term> methods for instance variables in Java.
163
+
<idx>getter method</idx>
164
+
<idx>setter method</idx>
165
+
Direct access to instance variables is not allowed in Java.
166
+
Therefore if we legitimately want to be able to access information such as the numerator or the denominator for a particular fraction we must have a <term>getter method</term> that returns the needed value.
167
+
Hence, it is a very common programming practice to both provide <term>getter methods</term> and <term>setter methods</term> when needed for instance variables in Java.
0 commit comments