Вы находитесь на странице: 1из 2

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.

public static void main(String [] args) {

8.
9.
10. }

TestCount t = new TestCount();


t.countUp();

11. public void countUp() {


12.

for (int x = 6; x>counter; x--, ++counter) {

13.
14.

System.out.print(" " + counter);


}

15. }
16. }
What is the result?
123
0123
1234
Compilation fails

Вам также может понравиться