How to Get the Power Value with Math in Java

From Java Example Source Code

Jump to: navigation, search

Contents

[edit] Overview - How to Get the Power Value with Math in Java

This Java example program introduce Math.pow.

[edit] Java Source Code

  • Package: example.math
  • File: Power.java
package example.math;
 
public class Power {
 
    public static void main(String[] args) {
	System.out.println(Math.pow(2, 2));
    }
}

[edit] What Result You Can Get

Run the program, you will get:

4.0

[edit] Required External Libraries and/or Files for this Java Example

Need nothing.


[edit] How to Run this Java Example Program

We recommend running this Java example program with Eclipse.

For assistance in working with Eclipse, please see How to Run Java Program with Eclipse.

It's fairly easy.



[edit] Question & Answer

Any question?

Click edit and post your question or answer here.


Personal tools