Question
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
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. What is true about private constructor?
View solution
Q. What would be the behaviour if this() and super() used in a method?
View solution
Q. What is false about constructor?
View solution
Q. What is true about Class.getInstance()?
View solution
Q. What is true about constructor?
View solution
Q. Abstract class cannot have a constructor.
View solution
Q. What is true about protected constructor?
View solution
Q. What is not the use of “this” keyword in Java?
View solution
Q. What would be the behaviour if one parameterized constructor is explicitly defined?
View solution
Q. What would be behaviour if the constructor has a return type?
View solution
Q. Which of the following has the highest memory requirement?
View solution
Q. Where is a new object allocated memory?
View solution
Q. Which of the following is a garbage collection technique?
View solution
Q. What is -Xms and -Xmx while starting jvm?
View solution
Q. Which exception is thrown when java is out of memory?
View solution
Q. How to get prints of shared object memory maps or heap memory maps for a given process?
View solution
Q. What happens to the thread when garbage collection kicks off?
View solution
Q. Which of the below is not a Java Profiler?
View solution
Q. Which of the below is not a memory leak solution?
View solution
Q. Garbage Collection can be controlled by a program?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!