Fabioux

Untitled

Jan 25th, 2022 (edited)
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. Metodo che ritorna booleano. Se la lista List <Integer> passata come parametro è strettamente
  2. crescente allora true se no false
  3.  
  4. private List<Integer> lista;
  5.  
  6. public List<Integer> isCrescente() {
  7.     for(int i=0; i<lista.size()-1; i++) {
  8.         if(lista.get(i)<lista.get(i+1))
  9.            return false;
  10.     return true;
  11.     }
  12.    }
  13.    
  14.    ERRORI:
  15.    Programma.java:9: error: incompatible types: boolean cannot be converted to List<Integer>
  16.            return false;
  17.                   ^
  18.  
  19. Programma.java:10: error: incompatible types: boolean cannot be converted to List<Integer>
  20.     return true;
  21.            ^
Add Comment
Please, Sign In to add comment