Finding Max Value in Array Using Java - Interview Tips

Source Code:-  

For Daily Java Tips Follow Click here👉👉👉  d_programming_ 👈👈👈Official Instagram
package main;

public class FindMaxValueinArray {
public static void main(String[] args) {
int[] arr={3,6,-1,-2,7,88,44,66,23,54};
int max=arr[0];
for(int i:arr){
max=Math.max(max,i);
}
System.out.println("Max value is : "+max);
}
}
Output: Max value is : 88




CONVERSATION

0 Comments:

Post a Comment