Home / MCQ Bank / Computer
Computer Constructors And Methods Difficulty: Medium

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(); } }

Select the correct option to test your answer:

More Computer Questions

Which of the following isn't used in the storage phase of a computer-based information system? insertId attribute returns . . . . . . . . What is the purpose of a constructor in C++? Which command is used for taking "server side help" in Mysql command line tool? What will be the output of the following C++ code? #include <iostream> #include <cstring> using namespace std; int main () { char str1[10] = "Hello"; char str2[10] = "World"; char str3[10]; int len ; strcpy( str3, str1); strcat( str1, str2); len = strlen(str1); cout << len << endl; return 0; }