this block of code going straight to break in java
- by user2914851
I have this block in a switch case statement that when selected, just breaks and presents me with the main menu again.
System.out.println("Choose a competitor surname");
String competitorChoice2 = input.nextLine();
int lowestSpeed = Integer.MAX_VALUE;
int highestSpeed = 0;
for(int j = 0; j < clipArray.length; j++) {
if(clipArray[j] != null) {
if(competitorChoice2.equals(clipArray[j].getSurname())) {
if(clipArray[j].getSpeed() > clipArray[highestSpeed].getSpeed()) {
highestSpeed = j;
}
}
}
}
for(int i = 0; i < clipArray.length; i++) {
if(clipArray[i] != null) {
if(competitorChoice2.equals(clipArray[i].getSurname())) {
if(clipArray[i].getSpeed() < clipArray[lowestSpeed].getSpeed()) {
lowestSpeed = i;
}
}
}
}
for(int h = lowestSpeed; h < highestSpeed; h++ ) {
System.out.println(""+clipArray[h].getLength());
}
I have an array of objects and each object has a surname and a speed.
I want the user to choose a surname and display the speeds of all of their clips from lowest to highest.
when I select this option it just breaks and brings me back to the main menu