fork download
  1. class Main {
  2. public static void main(String[] args) {
  3. int [] arr={7,2,6,9,4};
  4. int max=0;
  5. for(int e:arr){
  6. if( e>max){
  7. max=e;
  8.  
  9. }
  10. }
  11. System.out.println("The maximum number of this array is:"+max);
  12. }
  13. }
Success #stdin #stdout 0.12s 55656KB
stdin
Standard input is empty
stdout
The maximum number of this array is:9