math.pow int
數學類靜態int min(int i1,int i2) (Math Class static int min(int i1 , int i2) )
This method is available in java.lang package.
此方法在java.lang包中可用。
This method is used to return the minimum one of both the given arguments or in other words this method returns the smallest value of the given two arguments.
此方法用于返回給定兩個參數中的最小值。換句話說,此方法返回給定兩個參數中的最小值。
This is a static method so this method is accessible with the class name too.
這是一個靜態方法,因此也可以使用類名訪問此方法。
The return type of this method is int, it returns the smallest element from the given two arguments.
此方法的返回類型為int ,它從給定的兩個參數中返回最小的元素。
This method accepts two arguments of integer (int) types.
此方法接受兩個整數( int )類型的參數。
This method does not throw any exception.
此方法不會引發任何異常。
Syntax:
句法:
public static int min(int i1, int i2){
}
Parameter(s): int i1, int i2 – two integer values, in which we have to find the smallest/minimum value.
參數: int i1,int i2 –兩個整數值,我們必須在其中找到最小/最小值。
Return value:
返回值:
The return type of this method is int, it returns the smallest/minimum value.
此方法的返回類型為int ,它返回最小/最小值。
Note:
注意:
If we pass "NaN" (Not a Number), it returns the same value i.e. "NaN".
如果我們傳遞“ NaN”(不是數字),它將返回相同的值,即“ NaN”。
If we pass zero (-0 or 0), it returns the 0.
如果傳遞零(-0或0),則返回0。
If we pass the same values in both parameters, it returns the same value.
如果我們在兩個參數中傳遞相同的值,則它將返回相同的值。
Java程序演示min(int i1,int i2)方法的示例 (Java program to demonstrate example of min(int i1,int i2) method)
// Java program to demonstrate the example of
// min(int i1, int i2) method
public class MinDoubleTypeMethod {
public static void main(String[] args) {
// declaring variables
int i1 = -0;
int i2 = 0;
int i3 = -2;
int i4 = 124;
// displaying the values
System.out.println("i1: " + i1);
System.out.println("i2: " + i2);
System.out.println("i3: " + i3);
System.out.println("i4: " + i4);
// Here , we will get (-2) because we are passing
// parameter whose value is (-0,0)
System.out.println("Math. min(i1,i3): " + Math.min(i1, i3));
// Here , we will get (0) because we are passing
// parameter whose value is (-0,0)
System.out.println("Math.min(i1,i2): " + Math.min(i1, i2));
// Here , we will get (0) and we are passing
// parameter whose value is (0,124)
System.out.println("Math.min(i2,i4): " + Math.min(i2, i4));
}
}
Output
輸出量
E:\Programs>javac MinDoubleTypeMethod.java
E:\Programs>java MinDoubleTypeMethod
i1: 0
i2: 0
i3: -2
i4: 124
Math. min(i1,i3): -2
Math.min(i1,i2): 0
Math.min(i2,i4): 0
翻譯自: https://www.includehelp.com/java/math-class-static-int-min-int-i1-int-i2-with-example.aspx
math.pow int