91. What will be the output of the following Java program, Command line exceution is done as - "java Output This is a command Line"?
class Output
{
public static void main(String args[])
{
System.out.print(args[3]);
}
}
class Output
{
public static void main(String args[])
{
System.out.print(args[3]);
}
}
92. What will be the output of the following Java code snippet run as $ java Demo -length 512 -breadth 2 -h 3?
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);
}
}
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);
}
}
93. Which of the following statements are incorrect?
94. What will be the output of the following Java program?
class string_demo
{
public static void main(String args[])
{
String obj = "I" + "like" + "Java";
System.out.println(obj);
}
}
class string_demo
{
public static void main(String args[])
{
String obj = "I" + "like" + "Java";
System.out.println(obj);
}
}
95. What will be the output of the following Java program?
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);
}
}
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);
}
}
96. Which of these can be used to differentiate two or more methods having the same name?
97. Which of these is the method which is executed first before execution of any other thing takes place in a program?
98. Which one of the following is not an access modifier?
99. How many arguments can be passed to main()?
100. Which of these statement is 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.