Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package boxdemo;
- class box{
- int height;
- int weight;
- double depth;
- box(int h,int w,double d){
- height=h;
- weight=w;
- depth=d;
- }
- void displyVol(){
- double ans = height*weight*depth;
- System.out.println(ans);
- }
- }
- public class Boxdemo {
- public static void main(String[] args) {
- box b1 = new box(10,10,10);
- b1.displyVol();
- box b2 = new box(20,30,10);
- b2.displyVol();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement