Multiple Choice Question

Quiz Guidelines



What is the result of compiling and running the following code?

public class TestClass{
static int si = 10;
public static void main (String args[]){
new TestClass();
public TestClass(){
public String toString(){
return " = ";
}   }

Select 1 option

A. The class will not compile because you cannot override toString() method.
B. The class will not compile as si being static, is not a valid statement.
C. It will print TestClass@nnnnnnnn, where nnnnnnn is the hash code of the TestClass object referred to by 'this'.
D. It will print = 10;
E. None of the above.

Q&A Set: