Home / MCQ Bank / Computer
Computer Constructors And Methods

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

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • 25

Related Computer Questions

In how many ways templates concept can be used? Which element is used to get highlighted text in HTML5? In Access to open new database press What will be the output of the following C++ code? #include <iostream> using namespace std; int main () { char first, second; cout << "Enter a word: "; first = cin.get(); cin.sync(); second = cin.get(); cout << first << endl; cout << second << endl; return 0; } Which of the following provides a list of synonyms?