Java Integer min() MethodThe min() is a method of Integer class under java.lang package. This method numerically returns the minimum value amongst the two method argument specified by a user. This method can be overloaded and it takes the arguments in int, double, float and long. Note: If a positive and a negative number is passed as an argument, it generated the negative result. And if both the parameters passed as a negative number, it generates a result with the greater magnitude.Syntax:Following is the declaration of min() method: Parameter:
Returns:The min() method returns the smaller value amongst the two method argument specified by a user. Exceptions:NA Compatibility Version:Java 1.5 and above Example 1Output: Math.min(5485,3242)=3242 Example 2Output: Enter the Two Numeric value: 45 76 Smaller value of Math.min(45,76) = 45 Example 3Output: Result: -70 Example 4Output: Result: -20 Next TopicJava-integer-numberofleadingzeros-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India