Miscellaneous In Java - Study Mode
[#81] In Java, which exception is thrown when an object is accessed before it has been initialized?
Correct Answer
(C) NullPointerException
[#82] Which Java class is used to represent an ordered collection of elements?
Correct Answer
(B) List
[#83] What is the purpose of the `synchronized` keyword in Java?
Correct Answer
(C) To create a synchronized block of code for multithreading
[#84] In Java, what does the `this` keyword refer to?
Correct Answer
(D) It refers to the current instance of the class
[#85] What will be the output of the following Java snippet, if compiled and executed with command line "hello there"? public class abc
{
String[] xyz
public static void main(String argv[])
{
xyz=argv
}
public void runMethod()
{
System.out.println(argv[1])
}
}
Correct Answer
(A) Compile time error