Select an option to see the answer and solution.
Miscellaneous Java
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
121
Questions
4/7
Page
Pick an option on a question to see the right answer and solution.
Select an option to see the answer and solution.
public class abc
{
String[] xyz;
public static void main(String argv[])
{
xyz=argv;
}
public void runMethod()
{
System.out.println(argv[1]);
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
public class demo
{
public static void main(String args[])
{
System.out.println(args[0]+""+args[args.length-1]);
}
}Select an option to see the answer and solution.
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);
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
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] + " ");
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.length());
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
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);
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.