Examveda

What will be the output of the following Java 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

Answer: Option D


This Question Belongs to Java Program >> Miscellaneous In Java

Join The Discussion

Related Questions on Miscellaneous in Java