Java program to calculate volume of a Box

By: Paawan Chaudhary  

This is a Java program to accomplish following task.

  1. Create a user-defined package box which has a class definition. For box having data member and disp( )method . (Assume suitable data )
  2. Source file imports above package and calculates the volume of box .
import java.lang.*;
Pacakage BoxPackage
	public class Box
		int length, breadth, height;
		Box(int I,int b,int h)
		public void display()
			int volume=length*breadth*height;
			System.out.println("Volume of Box is"+volume);
class Boxdemo
	public static void main(string args[])
		Box b=new Box(10,20,30);

Archived Comments

1. I have noticed you don't monetize your page, don't waste your traffic, you can earn additional bucks
View Tutorial          By: 86Ernesto at 2017-09-03 12:57:48

2. thanks very much
View Tutorial          By: abrham at 2012-12-20 07:36:14

Most Viewed Articles (in Java )

Latest Articles (in Java)

Comment on this tutorial