This is a Java Program to Find the Volume and Surface Area of Sphere.

formula:

Area=3*pi*r*r

Volume=(4/3)*pi*r*r*r

formula:

Area=3*pi*r*r

Volume=(4/3)*pi*r*r*r

Enter the radius as input. Now we calculate the surface area and volume by using formula and get the desired output.

Here is the source code of the Java Program to Find the Volume and Surface Area of Sphere.The Java program is successfully compiled and run on a Windows system. The program output is also shown below.

import java.util.Scanner;

public class Volume_SurfaceArea

`{`

public static void main(String[] args)

`{`

int r;

double area, volume, pi = 3.14;

Scanner s = new Scanner(System.in);

System.out.print("Enter the radius of sphere:");

r = s.nextInt();

area = 3 * pi * r * r;

System.out.println("Surface Area of sphere:"+area);

volume = 1.333 * pi * r * r * r;

System.out.println("Volume of sphere:"+volume);

`}`

`}`

Output:

$ javac Volume_SurfaceArea.java $ java Volume_SurfaceArea Enter the radius of sphere:4 Surface Area of sphere:150.72 Volume of sphere:267.87968

**Sanfoundry Global Education & Learning Series – 1000 Java Programs.**

Here’s the list of Best Reference Books in Java Programming, Data Structures and Algorithms.