class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.charAt(3));
}
}Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
121
Questions
5/7
Page
Pick an option on a question to see the right answer and solution.
class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.charAt(3));
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
class access
{
public int x;
static int y;
void cal(int a, int b)
{
x += a ;
y += b;
}
}
class static_specifier
{
public static void main(String args[])
{
access obj1 = new access();
access obj2 = new access();
obj1.x = 0;
obj1.y = 0;
obj1.cal(1, 2);
obj2.x = 0;
obj2.cal(2, 3);
System.out.println(obj1.x + " " + obj2.y);
}
}Select an option to see the answer and solution.
public class abc
{
static public void main(String [] xyz)
{
for(int n=1;n<xyz.length; n++)
{
System.out.println(xyz[n]+"");
}
}
}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 = "hello";
String obj1 = "world";
String obj2 = obj;
obj2 = " world";
System.out.println(obj + " " + obj2);
}
}Select an option to see the answer and solution.
class area
{
int width;
int length;
int height;
area()
{
width = 5;
length = 6;
height = 1;
}
void volume()
{
volume = width * height * length;
}
}
class cons_method
{
public static void main(String args[])
{
area obj = new area();
obj.volume();
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.
class string_class
{
public static void main(String args[])
{
String obj = "hello";
String obj1 = "world";
String obj2 = "hello";
System.out.println(obj.equals(obj1) + " " + obj.equals(obj2));
}
}Select an option to see the answer and solution.
class Output
{
public static void main(String args[])
{
System.out.print(args[3]);
}
}Select an option to see the answer and solution.
class Demo {
@Parameter(names={"--length"})
int length;
@Parameter(names={"--breadth"})
int breadth;
@Parameter(names={"--height","-h"})
int height;
public static void main(String args[])
{
Demo demo = new Demo();
new JCommander(demo, args);
demo.run();
}
public void run()
{
System.out.println(length+" "+ breadth+" "+height);
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
class string_demo
{
public static void main(String args[])
{
String obj = "I" + "like" + "Java";
System.out.println(obj);
}
}Select an option to see the answer and solution.
class Output
{
static void main(String args[])
{
int x , y = 1;
x = 10;
if(x != 10 && x / 0 == 0)
System.out.println(y);
else
System.out.println(++y);
}
}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.
Select an option to see the answer and solution.
Q100
Open questionSelect an option to see the answer and solution.