请教各位几道JAVA试题!希望大家帮忙!

hpym365 hpym365 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
1、Refer的类层次结构,如下图所示。

动物
狗 猫 .....
Consider the following code:
1. Dog rover, fido;
2. Animal anim;
4. rover = new Dog();
5. anim = rover;
6. fido = (Dog)anim;
Which of the following statements is true? (Choose one.) My answer is D
A. Line 5 will not compile.
B. Line 6 will not compile.
C. The code will compile but will throw an exception at line 6.
D. The code will compile and run.
E. The code will compile and run, but the cast in line 6 is not required and can be eliminated.





2、请说出如下几个类的特性 并说明Collection 和 Collections的区别?
a) java.util.ArrayList


b) java.util.HashSet


c) java.util.TreeSet


d) java.util.HashMap HashMap和Hashtable的区别


3、一个JSP页面传递了一个request对象名字"test" 该页面使用标签
<bean:write name="test" property="info.value">

请说明显示的内容来自于哪里?
My answer :Test 对象内关联的 info对象的 value值




4、编写程序 带2个输入参数 起始值 最大值
比如 输出1-100的质数 (质数:只能被自己和1整除的自然数)



...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
hpym365
Java SE 62,620 成员 307,251 内容