Java program
If the problem with Voluminous and Box in the question above is fixed (if necessary), and Box still implements Voluminous, which of the following lines of code would compile and run correctly?
Extracted text: If the problem with voluminous and Box in the question above is fixed (if necessary), and Box still implements voluminous , which of the following lines of code would compile and run correctly? You can select as many answers as you want. Box x = new Box(2, 3, 4); Voluminous x = new Box(2, 3, 4); Voluminous x = new Voluminous (2, 3, 4); voluminous [] a = new Voluminous[18]; a[e] = new Box(2, 3, 4); voluminous x - new Voluminous (); Box x = new Box ();Extracted text: What is wrong with the following code? // voluminous.java: interface voluminous { public double volume (); } // Box.java: class Box implements Voluminous { double length, width, height; public Box(double 1, double w, double h) { length = width = w; height = h; } 1; public double getvolume () { return (length * width * height); } } O Nothing is wrong. The code will compile and work correctly. O The getvolume method needs to have length. width, and height as parameters. O The Box class doesn't have a method called volume so it doesn't correctly implement voluminous O The variables (length . width. and height need an access level (e.g. public or private ) O The Box class must be defined as abstract , because only an abstract class can implement an interface.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here