mardi 4 juillet 2017

continue with if statement java

why I can't use continue with The ? : Operator :

public class TestArray {

public static void main(String[] args) {
  double[] myList = {1.9, 2.9, 3.4, 3.5};

  // Print all the array elements
  for (int i = 0; i < myList.length; i++) {
     System.out.println(myList[i] + " ");
  }


  // Finding the largest element
  double max = myList[0];
  for (int i = 1; i < myList.length; i++) {
     myList[i] > max ? max = myList[i] : continue ;
  }
  System.out.println("Max is " + max);  
}
} 

Aucun commentaire:

Enregistrer un commentaire