V

Vijay Sangwan • 28.62K Points
Instructor II

Q. What will be the output of the following Java code?
class box 
{
    int width;
    int height;
    int length;
    int volume;
    void finalize() 
    {
        volume = width*height*length;
        System.out.println(volume);
    }
    protected void volume() 
   {
        volume = width*height*length;
        System.out.println(volume);
   } 
}    
class Output 
{ 
    public static void main(String args[])
    {
        box obj = new box();
        obj.width=5;
        obj.height=5;
        obj.length=6;
        obj.volume();
    } 
}

  • (A) 150
  • (B) Mark and sweep model
  • (C) Run time error
  • (D) Compilation error
  • Correct Answer - Option(A)
  • Views: 10
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics