Question
interface Foo141
{
int k = 0; /* Line 3 */
}
public class Test141 implements Foo141
{
public static void main(String args[])
{
int i;
Test141 test141 = new Test141();
i = test141.k; /* Line 11 */
i = Test141.k;
i = Foo141.k;
}
}
a.
Compilation fails.
b.
Compiles and runs ok.
c.
Compiles but throws an Exception at runtime.
d.
Compiles but throws a RuntimeException at runtime.
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What will be the output of the program?
Similar Questions
Discover Related MCQs
Q. Which statement is true given the following?
Double d = Math.random();
View solution
Q. Which two statements are true about wrapper or String classes?
1. If x and y refer to instances of different wrapper classes, then the fragment x.equals(y) will cause a compiler failure.
2. If x and y refer to instances of different wrapper classes, then x == y can sometimes be true.
3. If x and y are String references and if x.equals(y) is true, then x == y is true.
4. If x, y, and z refer to instances of wrapper classes and x.equals(y) is true, and y.equals(z) is true, then z.equals(x) will always be true.
5. If x and y are String references and x == y is true, then y.equals(x) will be true.
View solution
Q. Which of the following will produce an answer that is closest in value to a double, d, while not being greater than d?
View solution
Q. What two statements are true about the result obtained from calling Math.random()?
1. The result is less than 0.0.
2. The result is greater than or equal to 0.0..
3. The result is less than 1.0.
4. The result is greater than 1.0.
5. The result is greater than or equal to 1.0.
View solution
Q. Which of these class have only one field "TYPE"?
View solution
Q. Standard output variable "out" is defined in which class?
View solution
Q. Which of the following is method of wrapper Float for converting the value of an object into byte?
View solution
Q. A command-line argument in Java is a value passedat the time of ___ a program.
View solution
Q. Command-line arguments help in a way of ____ data to a program.
View solution
Q. The command-line arguments are passes at ____.
View solution
Q. When a Java program is executed once, how many times can you pass data using the Command-line arguments?
View solution
Q. If you need to accept data at runtime, you use ___ in Java.
View solution
Q. Which is the method that accepts data passed in the form of command-line arguments in Java?
View solution
Q. The command-line arguments in Java are used along with a ____ command.
View solution
Q. The type of Arguments the MAIN method accepts is ___.
View solution
Q. The data that is passed at the time of running a Java program as command-line arguments are converted into ___ data type.
View solution
Q. The delimiter used to separate command-line arguments in Java is ____.
View solution
Q. Can you pass a sentence with multiple words separated by spaces as a single command-line argument in Java?
View solution
Q. Is there any limit to the number of spaces between two arguments of command-line arguments in Java?
View solution
Q. To pass a string as a command-line argument in Java, you need to surround the text within a pair of ___.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!