What will be the output of the following Java code? [code] class box { int width; int height; int length;

Mỹ An

New member
What will be the output of the following Java code?
Code:
    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        box() 
        {
            width = 5;
            height = 5;
            length = 6;
        }
        void volume() 
        {
             volume = width*height*length;
        } 
    }    
    class constructor_output 
    {
        public static void main(String args[])
        {
            box obj = new box();
            obj.volume();
            System.out.println(obj.volume);
        }
   }
A. 100
B. 150
C. 200
D. 250
 

Tìm kiếm

Back
Top