71. Which of these methods must be made static?
72. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length - 2; ++i)
System.out.println(arr[i] + " ");
}
}
class Output
{
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length - 2; ++i)
System.out.println(arr[i] + " ");
}
}
73. What is the process of defining more than one method in a class differentiated by parameters?
74. How can a protected modifier be accessed?
75. What will be the output of the following Java program?
class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.length());
}
}
class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.length());
}
}
76. Which of these keywords is used to prevent content of a variable from being modified?
77. 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;
}
void volume(int x)
{
volume = x;
}
}
class Output
{
public static void main(String args[])
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(5);
System.out.println(obj.volume);
}
}
class box
{
int width;
int height;
int length;
int volume;
void volume()
{
volume = width * height * length;
}
void volume(int x)
{
volume = x;
}
}
class Output
{
public static void main(String args[])
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(5);
System.out.println(obj.volume);
}
}
78. How do we pass command line argument in Eclipse?
79. Which is the modifier when there is none mentioned explicitly?
80. Which of the following statements are incorrect?
Read More Section(Miscellaneous in Java)
Each Section contains maximum 100 MCQs question on Miscellaneous in Java. To get more questions visit other sections.