91. What is false about constructor?
92. Which of these packages contains the exception Stack Overflow in Java?
93. What will be the output of the following Java program?
class equality
{
int x;
int y;
boolean isequal()
{
return(x == y);
}
}
class Output
{
public static void main(String args[])
{
equality obj = new equality();
obj.x = 5;
obj.y = 5;
System.out.println(obj.isequal());
}
}
class equality
{
int x;
int y;
boolean isequal()
{
return(x == y);
}
}
class Output
{
public static void main(String args[])
{
equality obj = new equality();
obj.x = 5;
obj.y = 5;
System.out.println(obj.isequal());
}
}
94. What will be the output of the following Java program?
class box
{
int width;
int height;
int length;
}
class mainclass
{
public static void main(String args[])
{
box obj1 = new box();
box obj2 = new box();
obj1.height = 1;
obj1.length = 2;
obj1.width = 1;
obj2 = obj1;
System.out.println(obj2.height);
}
}
class box
{
int width;
int height;
int length;
}
class mainclass
{
public static void main(String args[])
{
box obj1 = new box();
box obj2 = new box();
obj1.height = 1;
obj1.length = 2;
obj1.width = 1;
obj2 = obj1;
System.out.println(obj2.height);
}
}
95. What is the return type of Constructors?
96. Which of the following has the highest memory requirement?
97. What will be the output of the following Java code?
class A
{
A()throws IOException
{
}
}
class B extends A
{
B()
{
}
public static void main(String[]args)
{
}
}
class A
{
A()throws IOException
{
}
}
class B extends A
{
B()
{
}
public static void main(String[]args)
{
}
}
98. Abstract class cannot have a constructor.
99. Which of the following is not OOPS concept in Java?
100. Garbage Collection can be controlled by a program?
Read More Section(Constructors and Methods)
Each Section contains maximum 100 MCQs question on Constructors and Methods. To get more questions visit other sections.