(ArrayList<Integer> list)
| 2 | |
| 3 | public class PrintMaximum { |
| 4 | public static void printMax(ArrayList<Integer> list) { |
| 5 | int max = Integer.MIN_VALUE; |
| 6 | for(int i=0; i<list.size(); i++) { |
| 7 | if(max < list.get(i)) { |
| 8 | max = list.get(i); |
| 9 | } |
| 10 | } |
| 11 | System.out.println("max = " + max); |
| 12 | } |
| 13 | public static void main(String args[]) { |
| 14 | ArrayList<Integer> list = new ArrayList<>(); |
| 15 | list.add(1); |