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

    class box_Shape
    {
    int width;
    int height;
    int length;
    int vol;
    void vol()
    {
    vol = height * width * length;
    }
    }
    public class Result
    {
    public static void main(String args[])
    {
    box_Shape obj = new box_Shape();
    obj.height = 5;
    obj.length = 10;
    obj.width = 3;
    obj.vol();
    System.out.println(obj.vol);
    }
    }
    1. 150
    2. 100
    3. 200
    4. 50
    5. 250
Correct Option: A

Output: 150



Your comments will be displayed only after manual approval.