Q. What would be the result of attempting to compile and run the following code?
Code:
public class HelloWorld{
public static void main(String[] args){
double[] x = new double[]{1, 2, 3};
System.out.println("Value is " + x[1]);
}
}
β
Correct Answer: (D)
The program compiles and runs fine and the output