views
The java.lang.Math.pow() is used to calculate a quantity elevate to the facility of another quantity. This perform accepts two parameters and returns the worth of first parameter raised to the second parameter. There are some particular circumstances as listed beneath:
If the second parameter is constructive or coding techno detrimental zero then the result might be 1.0.
If the second parameter is 1.0 then the result might be similar as that of the primary parameter.
If the second parameter is NaN then the result will even be NaN.
Syntax :
Attention reader! Don’t cease studying now. Get maintain of all of the essential Java Foundation and Collections ideas with the Fundamentals of Java and Java Collections Course at a student-friendly value and grow to be trade prepared. To full your preparation from studying a language to DS Algo and plenty of extra, please refer Complete Interview Preparation Course .
public static double pow(double a, double b) Parameter : a : this parameter is the bottom b : this parameter is the exponent. Return : This technique returns ab .
Example 1 : To present working of java.lang.Math.pow() technique.
Output:
900.0 81.0 64.0
Example 2 : To present working of java.lang.Math.pow() technique when argument is NaN.
Output:
NaN 1.0 5.0
The java.lang.Math.pow() is used to calculate a quantity elevate to the facility of another quantity. This perform accepts two parameters and returns the worth of first parameter raised to the second parameter. There are some particular circumstances as listed beneath: If the second parameter is constructive or detrimental zero then the result might be 1.0.…
The java.lang.System.exit() methodology exits present program by terminating operating Java digital machine. This methodology takes a standing code. A non-zero worth of standing code is usually used to point irregular termination. This is analogous exit in C/C++.
Following is the declaration for java.lang.System.exit() methodology:
Attention reader! Don’t cease studying now. Get maintain of all of the necessary Java Foundation and Collections ideas with the Fundamentals of Java and Java Collections Course at a student-friendly value and grow to be business prepared. To full your preparation from studying a language to DS Algo and lots of extra, please refer Complete Interview Preparation Course.
public static void exit(int standing)
exit(0) : Generally used to point profitable termination.
exit(1) or exit(-1) or another non-zero worth – Generally signifies unsuccessful termination.
Note : This methodology doesn’t return any worth.
The following instance exhibits the utilization of java.lang.System.exit() methodology.
import java.util.*; import java.lang.*;
class GfG { public static void main(String[] args) { int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
for (int i = 0; i < arr.size; i++) { if (arr[i] >= 5) { System.out.println("exit...");
System.exit(0); } else System.out.println("arr["+i+"] = " + arr[i]); } System.out.println("End of Program"); } } |
Output:
arr[0] = 1
arr[1] = 2
arr[2] = 3
arr[3] = 4
exit...
Reference :
https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html
This article is contributed by Amit Khandelwal .If you want GeeksforGeeks and wish to contribute, you can too write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article showing on the GeeksforGeeks main web page and assist different Geeks.
Please write feedback in the event you coding technology discover something incorrect, otherwise you wish to share extra details about the subject mentioned above.
The java.lang.System.exit() methodology exits present program by terminating operating Java digital machine. This methodology takes a standing code. A non-zero worth of standing code is usually used to point irregular termination. This is analogous exit in C/C++. Following is the declaration for java.lang.System.exit() methodology: Attention reader! Don’t cease studying now. Get maintain of all of…