Java Array

Array Max Program

In this chapter, our task is to write a simple java program:

  • max element from the given array

Java program to find max from array

package array;

public class MaxArray {

	public static void main(String[] args) {
		int[] arr = {13, 17, 18, 23, 35, 65, 22};
		int max = -1;

		for(int i=0; i<arr.length; i++){
			if(arr[i]> max){
				max = arr[i];

		System.out.println("Max in array: "+ max);



Max in array: 65


To-Do: Re-write the above java program to find min element from the array 'arr'



Please Share this page
Views : 72
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!