About 378,000 results
Open links in new tab
  1. Box (Java Platform SE 8 ) - Oracle

    Box provides several class methods that are useful for containers using BoxLayout -- even non-Box containers. The Box class can create several kinds of invisible components that affect layout: glue, struts, and rigid areas.

  2. java - how to call length, width, height, area, volume of a box

    Dec 6, 2014 · public static Box createBox (int height, int width, int length) { return new Box(height, width, length); } In turn, your Box class should be storing these parameters as global members: public class Box { private final int height, width, length; public Box (int height, int width, int length) { this.height = height; ...

  3. Creating New Box class in Java - EasyCodeBook.com

    Oct 13, 2019 · Write a Java program for Creating New Box class in Java. Also write a user class / main class with main method to create objects of Box class.

  4. Java Box program with multiple methods and constructors

    Oct 19, 2018 · import java.util.Scanner; public class Box { public static void main(String args[]) { double length, width, height; Scanner input=new Scanner(System.in); new Box() { // Box defaultBox=new Box(); double length = 1.0; double width = 1.0; double height = 1.0; System.out.print("Default dimensions are " + length + " X " + width + " X " + height ...

  5. A simple Box class in Java - Java samples

    Mar 8, 2025 · Here is a complete program that uses the Box class: double width; double height; double depth; public static void main(String args[]) { Box mybox = new Box(); double vol; mybox.width = 10; mybox.height = 20; mybox.depth = 15; vol = mybox.width * mybox.height * mybox.depth; System.out.println("volume is" + vol);

  6. Method in Java Box class - Stack Overflow

    May 29, 2013 · All classes in Java have to be compiled into separate files. Hence, when you used javac, two files were created and not one - as you would have anticipated. That's because Boxdemo is your driver class - which calls and instantiates the methods of the Box class. Second, when you compile programs with javac, it creates a .class file for every ...

  7. Example of Classes and Objects in JavaBox Class

    This example demonstrate some of the concepts of object-oriented programming. We have a class named Box. It has three data members – width, height, and depth. Also, the Box class defines a parameterized constructor and a method that returns the volume of the Box.

  8. Java program to calculate volume of a Box - Java samples

    Sep 19, 2012 · This is a Java program to Create a user-defined package box which has a class definition. For box having data member and disp()method and calculate volume from a source file.

  9. Java Class to Calculate the Volume of Box

    Jan 30, 2012 · Here is a Java Class to Calculate the Volume of Box. class Box { double width; double height; double depth; // This is the constructor for Box. Box(double w, double h, double d) { width = w; height = h; depth = d; } // compute and return volume double volume() { return width * height * depth; } }

  10. Java Program to find the Volume of a Box

    Nov 13, 2016 · Volume of a Box in Java The below program demonstrates simple class creation and perform volume calculation of a box.

  11. Some results have been removed
Refresh