Submitted by c-admin on Wed, 06/05/2019 - 02:15
What, if anything, is wrong with the following code?
interface T1{
}
interface T2{
int VALUE = 10;
void m1();
}
interface T3 extends T1, T2{
public void m1();
public void m1(int x);
}
Select 1 option
A. T3 cannot implement both T1 and T2 because it leads to ambiguity.
B. There is nothing wrong with the code.
C. The code will work fine only if VALUE is removed from T2 interface.
D. The code will work fine only if m1() is removed from either T2 and T3.
E. None of the above.
Submitted by c-admin on Wed, 06/05/2019 - 02:13
Consider the following interface definition:
public interface ConstTest{
public int A = 1; //1
int B = 1; //2
static int C = 1; //3
final int D = 1; //4
public static int E = 1; //5
public final int F = 1; //6
static final int G = 1; //7
public static final int H = 1; //8
}
Which line(s) will cause a compilation error?
Select 1 option
A. 1
B. 2
C. 3
D. 4
E. 5
F. 6
G. 7
H. 8
I. None of them will cause any error.
Submitted by c-admin on Fri, 05/31/2019 - 05:59
What is the correct declaration for an abstract method 'add' accessible to any class, takes no arguments and returns nothing? (Use only one space between words)
Select 1 option
A. public void add();
B. abstract add();
C. abstract null add();
D. abstract public void add(){ }
E. abstract public void add() throws Exception;
Submitted by c-admin on Fri, 05/31/2019 - 05:58
Given the definitions of I and Klass, complete the definition of SubClass so that it extends from Klass and implements I.

Submitted by c-admin on Fri, 05/31/2019 - 05:54
Which of the given statements are correct for a method that overrides the following method:
public Set getSet(int a) {...}
Select 3 options
A. Its return type must be declared as Set.
B. It may return HashSet.
C. It can declare any Exception in throws clause
D. It can declare any RuntimeException in throws clause.
E. It can be abstract.
Pages