adplus-dvertising
frame-decoration

Question

What is the output of this program?
    class area 
    {
        int width;
        int length;
        int height;
        area() 
        {
        width = 5;
        length = 6;
        height = 1;
        }
        void volume() 
        {
             volume = width * height * length;
        } 
    }    
    class cons_method 
    {
        public static void main(String args[]) 
        {
            area obj = new area();
            obj.volume();
            System.out.println(obj.volume);
        } 
    }

a.

0

b.

1

c.

25

d.

30

Posted under Java Programming

Answer: (d).30

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?