Program to calculate Area Of Octagon | Java Program to find area of Octagon . ; utility function ; driver code
import java . io . * ; class GFG { static double areaOctagon ( double side ) { return ( float ) ( 2 * ( 1 + Math . sqrt ( 2 ) ) * side * side ) ; } public static void main ( String arg [ ] ) { double side = 4 ; System . out . print ( " Area ▁ of ▁ Regular ▁ Octagon ▁ = ▁ " + areaOctagon ( side ) ) ; } }