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

    class box_Shape
    {
    int w;
    int h;
    int l;
    int vol;
    void vol()
    {
    vol = w * h * l;
    }
    void vol(int p)
    {
    vol = p;
    }
    }
    public class Result
    {
    public static void main(String args[])
    {
    box_Shape bs = new box_Shape();
    bs.h = 2;
    bs.l = 7;
    bs.w = 6;
    bs.vol(6);
    System.out.println(bs.vol);
    }
    }
    1. 50
    2. 5
    3. 60
    4. 6
    5. 16
Correct Option: D

Output: 6



Your comments will be displayed only after manual approval.