a) int b) float c) void d) double Answer: c Explanation: Return type of ...
View Question
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 obj = new box();
System.out.println(obj);
}
}
What will be the output of the following Java program? class box ...
View Question
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);
}
}
What will be the output of the following Java program? class box ...
View Question
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 obj = new box();
obj.width = 10;
obj.height = 2;
obj.length = 10;
int y = obj.width * obj.height * obj.length;
System.out.print(y);
}
}
What will be the output of the following Java program? class box ...
View QuestionWhich of the following statements is correct?
a) Public method is accessible to all other classes in the hierarchy b) Public method is accessible only ...
View Question
What will be the output of the following Java program?
class main_class
{
public static void main(String args[])
{
int x = 9;
if (x == 9)
{
int x = 8;
System.out.println(x);
}
}
}
What will be the output of the following Java program? class main_class ...
View QuestionWhich of these statement is incorrect?
a) Every class must contain a main() method b) Applets do not require a main() method at all
View QuestionWhich of these operators is used to allocate memory for an object?
a) malloc b) alloc c) new d) give Answer: c Explanation: Operator new dynamically allocates memory for an ...
View QuestionWhich of the following is a valid declaration of an object of class Box?
a) Box obj = new Box(); b) Box obj = new Box; c) obj = new Box(); d) new Box ...
View QuestionWhich of these keywords is used to make a class?
a) class b) struct c) int d) none of the mentioned Answer: a
View Question