What will be the output of the following Java code?

class box 
  {
      int width;
      int height;
      int length;
      int volume;
      box() 
      {
          width = 5;
          height = 5;
          length = 6;
      }
      void volume() 
      {
           volume = width*height*length;
      } 
  }    
  class constructor_output 
  {
      public static void main(String args[])
      {
          box obj = new box();
          obj.volume();
          System.out.println(obj.volume);
      }
 }

a) 100
b) 150
c) 200
d) 250

1 thought on “What will be the output of the following Java code?”

Leave a Comment