In the previous article, we have seen Java Program to Find Volume of Octahedron

In this article we are going to see how to find the surface area of octahedron using Java programming language.

## Java Program to Find Surface Area of Octahedron

Before Jumping into the program directly let’s see how we can find the surface area of octahedron.

**Explanation:**

An regular octahedron is a polyhedron which has 8 faces 12 edges and 6 vertices and all are in the shape of equilateral triangles. Formula to find total surface area of octahedron = 2*(sqrt(3))*(side*side)

Where,

`side`

represents length of an edge.

**Example: **

Let one side of octahedron be “l” = 3

So, surface area of octahedron = 2*(sqrt(3))*(side*side)

=> 2*(sqrt(3))*(3*3) = 31.1769

Let’s see different ways to find the surface area of octahedron.

### Method-1: Java Program to Find Surface Area of Octahedron By Using Static Value

**Approach:**

- Declare an integer variable say ‘
`l`

’ and assign the value to it, which holds the value of side length of the octahedron. - Find the surface area of octahedron using the formula
`2*(sqrt(3))*(3*3)`

- Print the result.

**Program:**

import java.util.*; class Main { public static void main(String [] args) { int l = 3; // formula to find surface area of octahedron double ar = 2*(Math.sqrt(3))*(3*3); System.out.println("The surface area of octahedron is: " + ar); } }

Output: The surface area of octahedron is: 31.17691453623979

### Method-2: Java Program to Find Surface Area of Octahedron By Using User Input Value

**Approach:**

- Declare an integer variable say ‘
`l`

’ and assign the value to it, which holds the value of side length of the octahedron. - Take the value of ‘
`l`

‘ as user input using Scanner class. - Find the surface area of octahedron using the formula
`2*(sqrt(3))*(3*3)`

- Print the result.

**Program:**

import java.util.*; class Main { public static void main(String [] args) { // Scanner class object Scanner s = new Scanner(System.in); // taking input of length of edge System.out.println("Enter the value of the side of the octahedron:"); int l = s.nextInt(); // formula to find surface area of octahedron double ar = 2*(Math.sqrt(3))*(3*3); System.out.println("The surface area of octahedron is: " + ar); } }

Output: Enter the value of the side of the octahedron: 4 The surface area of octahedron is: 31.17691453623979

Are you a job seeker and trying to find simple java programs for Interview? This would be the right choice for you, just tap on the link and start preparing the java programs covered to crack the interview.

**Related Java Articles:**