Java Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 5: Write a Java program to calculate the Surface Area of the Cuboid.

import java.util.Scanner;

public class SurfaceArea
	public static void main(String[] args)
		//Declaring Variables
		Scanner sc =new Scanner(;
		double length;
		double width;
		double height;
		double surfaceArea;
		System.out.println("Enter the length of the cuboid");
		System.out.println("Enter the width of the cuboid");
		System.out.println("Enter the height of the cuboid");
		surfaceArea = 2*(length*width + width*height + height*length);
		System.out.println("Surface Area: "+surfaceArea);

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.