by Dinesh Thakur

In Volume of a Sphere in Java Example , Math.PI is used because it denotes the value of pi i.e. 3.1414. Math.pow(r,3.0) is used for computing y3

Here is the Java Example for Volume of a Sphere

class  VolumeSphere

{          
             public  static  void  main  (String  args [ ] )           
      {                       
               int    r;                       
              double  m,v;                      
              r=9;                        
              m=Math.pow(r,3.0);                       
              v= (double)4/3*Math.PI*m;                       
             System.out.println("Volume  of  a  Sphere  is  "+v);          
       }
 }

Volume of a Sphere in Java