Professional Documents
Culture Documents
Given The Code Below
Given The Code Below
interface MyInterface {
void doSomething ( ) ;
}
class MyClass implements MyInterface {
// xx
}
Choose the valid option that can be substituted in place of xx in the MyClass class .
public native void doSomething ( ) ;
void doSomething ( ) { /* valid code fragments */ }
private void doSomething ( ) { /* valid code fragments */ }
protected void doSomething ( ) { /* valid code fragments */ }
interface I1 {
void draw();
}
class C implements I1 {
xxxxxx
}
Which of the following when inserted at xxxxxx is a legal definition and
implementation ?
void draw() { }
public void draw() { }
protected void draw() { }
abstract void draw() { }
Given the following,
1. interface Count {
2.
short counter = 0;
3.
void countUp();
4. }
5. public class TestCount implements Count {
6.
7.
8.
9.
t.countUp();
10. }
11. public void countUp() {
12.
13.
14.
15. }
16. }
What is the result?
123
0123
1234
Compilation fails