Reputation: 3
Im new to Java and confused about the getTestScore(int):
and setTestScore(int,int)
methods.
I dont understand how I can use getters and setters on an attribute that has yet to be defined. Should the ULM diagram first define something like private int testScore
;? Im sure Im overlooking something basic but Ive spent hours trying to figure it out.
Thanks
Upvotes: 0
Views: 151
Reputation: 953
The property test
is an array. setTestScore(i,s)
probably stores score s
at index i
in the test
array and getTestScore
retrieves the i
th element from the test
array.
It might have been more clear if the property was called testScores
Upvotes: 1