多项选择题

Given the following interface definition, which definitions are valid?()  
interface I {  
void setValue(int val);  
int getValue(); 
 }   
DEFINITION a:  
(a) class a extends I {  int value;  
void setValue(int val) { value = val; 
}  
int getValue() { 
return value;
 }  
}  
DEFINITION b:  
(b) interface b extends I {  
void increment(); 
 }  
DEFINITION c:  
(c) abstract class c implements I {  
int getValue() {
 return 0; 
}  abstract void increment();  
}  
DEFINITION d:  
(d) interface d implements I {  void increment();  }  
DEFINITION e:  
(e) class e implements I {  int value;  
public void setValue(int val) { value = val; }  }  

A.Definition a.
B.Definition b.
C.Definition c.
D.Definition d.
E.Definition e.

相关考题

Which method implementations will write the given strin...


单项选择题

Which method implementations will write the given string to a file named "file", using UTF8 encoding?()  
IMPLEMENTATION a: 
 public void write(String msg) throws IOException {  
FileWriter fw = new FileWriter(new File("file"));  
fw.write(msg);  
fw.close();  
}  
IMPLEMENTATION b: 
 public void write(String msg) throws IOException { 
 OutputStreamWriter osw =  new OutputStreamWriter(new FileOutputStream("file"), "UTF8");  osw.write(msg);  
osw.close();  
}  
IMPLEMENTATION c:  
public void write(String msg) throws IOException {  FileWriter fw = new FileWriter(new File("file"));  
fw.setEncoding("UTF8");  
fw.write(msg);  
fw.close();  }  
IMPLEMENTATION d:  
public void write(String msg) throws IOException {  FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8");  
fw.write(msg);  fw.close();  
}  
IMPLEMENTATION e:  
public void write(String msg) throws IOException {  
OutputStreamWriter osw = new OutputStreamWriter(  new OutputStream(new File("file")), "UTF8"  );  
osw.write(msg);  
osw.close();  
}  

A.Implementation a.
B.Implementation b.
C.Implementation c.
D.Implementation d.
E.Implementation e.