Q13
Given the code fragment:
public interface SampleCloseable {
public void close() throws java.io.IOException;
}
Which
implementation is valid?
A.
public class Test implements SampleCloseable {
public void close() throws java.io.IOException
{ // do something }
}
}
B.
public class Test implements SampleCloseable {
public void close() throws Exception { // do something }
}
}
C.
public class Test implementations SampleCloseable {
public void close() throws Exception { // do something }
}
}
D.
public class Test extends SampleCloseable {
public void close() throws
java.io.IOException { // do something }
}
}
public interface SampleCloseable {
public void close() throws Exception;
}
public class Test implements SampleCloseable {
public void close() throws
java.io.IOException { // do something }
}
}
Il codice avrebbe compilato senza problemi.
Nessun commento:
Posta un commento