Passing Array to method in java

Java Programming Language / Array in java

1231

Program:

public class ArrayExample {

   static void findmin(int arr[]){
  	 int min=arr[0];

  	 for(int i=1;i<arr.length;i++)
  		  if(min>arr[i])
  			   min=arr[i];

  		 System.out.println("Minimum value: "+min);
     }

   public static void main(String args[]){

   int a[]={22,4,6,7};
   findmin(a);//passing array to method

  }
}

Output:

Minimum value: 4
Press any key to continue . . .

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.