Home » JAVA Programming » Methods » Question
  1. What is the output of this program?

    class box_Shape
    {
    int width;
    int length;
    int height;
    int volume;
    box_Shape()
    {
    width=8;
    length=3;
    height=5;
    }
    void volume()
    {
    volume = width*length*height;
    }
    }
    public class cons_method_Example
    {
    public static void main(String args[])
    {
    box_Shape obj = new box_Shape();
    obj.volume();
    System.out.println(obj.volume);
    }
    }
    1. 100
    2. 110
    3. 120
    4. 130
    5. 140
Correct Option: C

output: 120



Your comments will be displayed only after manual approval.