import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
int [] arr = {2,3,4,5,5};
System.out.println("arr length="+arr.length);
for(int i=arr.length; i>0;)
{ --i;
System.out.println(arr[i]);
}
// maximum, minimum in array
System.out.println("highest num in array");
int[] arr2 = {2,4,6,7,67,89};
int max =0;
int max2 =0;
for (int elmnt :arr2)
{
if (elmnt>max)
{ max = elmnt;
}
else if (elmnt>max2 && elmnt!=max)
{
max2 = elmnt;
}
}
System.out.println(max);
System.out.println("second highest number is\n"+ max2);
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: