当前位置: 技术问答>java相关
急问一道SCJP摸拟题:
来源: 互联网 发布时间:2015-04-24
本文导语: Give the class hierachy and code snippets below ,select all valid subclasses of Kiosk(Choose two). Assumed class hierarchy: com.axtive.util.Kiosk com.axtive.util.AxtiveKiosk java.lang.Exception java.io.Exception java.io.UnsupportedEncodingException ...
Give the class hierachy and code snippets below ,select all valid subclasses of Kiosk(Choose two).
Assumed class hierarchy:
com.axtive.util.Kiosk
com.axtive.util.AxtiveKiosk
java.lang.Exception
java.io.Exception
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
4.public class Kiosk{
5.
6. public void write() throws IOException{
7. }
8.}
A.
public class AxtiveKiosk extends Kiosk{
public void write(){
}
}
B.
public class AxtiveKiosk extends Kiosk{
public void write() throws IOException{
}
}
C.
public class AxtiveKiosk extends Kiosk{
public void write() throws UnsupportedEncodingException,
java.lang.Exception{
}
}
D.
public class AxtiveKiosk extends Kiosk{
public void write() throws FileNotFoundException{
}
}
我选A,B,D,答案是B,D.
请问是不是答案错了?
Assumed class hierarchy:
com.axtive.util.Kiosk
com.axtive.util.AxtiveKiosk
java.lang.Exception
java.io.Exception
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
4.public class Kiosk{
5.
6. public void write() throws IOException{
7. }
8.}
A.
public class AxtiveKiosk extends Kiosk{
public void write(){
}
}
B.
public class AxtiveKiosk extends Kiosk{
public void write() throws IOException{
}
}
C.
public class AxtiveKiosk extends Kiosk{
public void write() throws UnsupportedEncodingException,
java.lang.Exception{
}
}
D.
public class AxtiveKiosk extends Kiosk{
public void write() throws FileNotFoundException{
}
}
我选A,B,D,答案是B,D.
请问是不是答案错了?
|
好像应该是ABD
|
应该abd 都是对的。我查了下Complete Study Guide,Chapter6 Test的第二
题,也是这样的选择。a 是可以的。
The absence of an exception list in A is not a problem:An overiding
method may legitimately throw fewer exceptions than its original,but
it may not throw more. 注意一开头说的。
题,也是这样的选择。a 是可以的。
The absence of an exception list in A is not a problem:An overiding
method may legitimately throw fewer exceptions than its original,but
it may not throw more. 注意一开头说的。
|
标准答案错了,呵呵~~
应该是ABD。
应该是ABD。
|
惨,我也觉得该选 abd
|
no wrong.