Java Program to calculate area of a Tetrahedron

JavaObject Oriented ProgrammingProgramming

A Tetrahedron is a polyhedron composed of four triangular faces, six straight edges, and four vertex corners.

Following is the Java program to calculate area of a Tetrahedron −


 Live Demo

public class Demo{
   static double tetra_vol(int side){
      double my_vol = (Math.pow(side, 3) / (6 * Math.sqrt(2)));
      return my_vol;
   public static void main(String[] args){
      int side = 4;
      double my_vol = tetra_vol(side);
      my_vol = (double)Math.round(my_vol * 100) / 100;
      System.out.println("The area of tetrahedron is");


The area of tetrahedron is

A class named Demo contains a static function named 'tetra_vol' which takes 'side' as a parameter. The formula to calculate area of a tetrahedron is ‘side’ cube/(6v2). This is computed and the output is returned. In the main function, the value of size is defined, and the function is called on this value. The output is printed on the console.

Updated on 07-Jul-2020 07:54:39