public static void main(String[] args) {
int[]myArray={1,2,34};
int max=0;
for(int i=0;i<myArray.length;i++) // we don't need = and ()
{
if (myArray[i]>max)
{
max=myArray[i];
}
}
System.out.println(max);
}
}
//output:
34
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter