Rian
Rian

Reputation: 3

Does this UML diagram make sense?

enter image description here

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

Answers (1)

Janoz
Janoz

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 ith element from the test array.

It might have been more clear if the property was called testScores

Upvotes: 1

Related Questions