Java Program to Find Volume and Surface Area of Sphere
import java.util.*;
public class Main
{
public static void main(String[] args)
{
//radius of sphere declared
double radius=1;
//finding surface area of sphere
double surfaceArea = 4 * Math.PI * radius * radius;
//finding volume of sphere
double volume = (4.0 / 3) * Math.PI * radius * radius * radius;
System.out.println("Surface area of Sphere = "+surfaceArea);
System.out.println("Volume of Sphere = "+ volume);
}
}
Output:
Surface area of Sphere = 12.566370614359172
Volume of Sphere = 4.1887902047863905
