Knowledge Walls
John Peter
Pune, Maharashtra, India
Get Minimum number from List of Numbers in Core Java with Example
2912 Views
GetMinNumberJava
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class  GetMinNumberJava {
    public static void main(String args[]) throws Exception{    
        List<Integer> numbers = new ArrayList<Integer>();
            numbers.add(10);
            numbers.add(20);
            numbers.add(30);
            numbers.add(40);
            
        int minNumber = Collections.min(numbers);
        System.out.println("Minimum is: "+minNumber);
    }
}
Output 
Minimum is: 10
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details