title: how to use math.pi in java
body: <p>I am having problems converting this formula <code>V = 4/3 π r^3</code>. I used <code>Math.PI</code> and <code>Math.pow</code>, but I get this error:</p>
  
  <blockquote>
    <p>';' expected</p>
  </blockquote>
  
  <p>Also, the diameter variable doesn't work. Is there an error there?</p>
  
  <pre><code>import java.util.Scanner;
  
  import javax.swing.JOptionPane;
  
  public class NumericTypes    
  {
      public static void main (String [] args)
      {
          double radius;
          double volume;
          double diameter;
  
          diameter = JOptionPane.showInputDialog("enter the diameter of a sphere.");
  
          radius = diameter / 2;
  
          volume = (4 / 3) Math.PI * Math.pow(radius, 3);
  
          JOptionPane.showMessageDialog("The radius for the sphere is "+ radius
  + "and the volume of the sphere is ");
      }
  }
  </code></pre>