mardi 9 janvier 2018

Compare two ints from same class, in a different class

Doing a big assignment for school and need help with a problem.

We need to compare two ints from "Class X" (Attribute class), in "Class Y" where we have some methods. This is just the structure of the assignment.

Our code so far:

public void addResult(Participant partResult) {

int participantIndex = -1;
for (int i = 0; i < resultList.size(); i++)   { 
if (resultList.get(i).getParticipant().getStartNumber() == partResult.getStartNumber())

Here we are stuck. We want to check if XY, we want to stop and send out error message. The problem is that X and Y is in a different class than this method. We can't seem to point to those attributes. The code is not compiling.

Aucun commentaire:

Enregistrer un commentaire