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整除的自然数)
狗 猫 .....
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整除的自然数)
解决方案 »
- sql语句问题,大虾帮忙
- 问一下一个java 输出格式的问题
- (换个版面 + 分再问)哪位大虾研究过Compiere,小弟请教一问题,先谢过~~~~
- notfiy, wait等和线程相关的方法为何在java.lang.object中出现
- JAVA socket编程 汉字无法传送!
- [高分]一直都在研究JTree做树型结构,可是怎么都弄不是很清楚,哪位有比较详细的例子呀?
- 新学JAVA做了个 QQ ,请大侠测试,给出建议或buf或修改意见的给源码,--UP有分
- 有哪位高手能够帮俺看出这个简单打印程序中的错误吗?
- 用java如何在NT上实现FTP服务?
- 急急急!!一个关于jdk1.4.0的问题
- 救命:读取 “UTF-8字符集编码” 的文件
- 关于java字符编码的问题
2.不是很懂,List和Set是集合类,List可以有重复元素,Set中不可以;Map是映射,key-value
3.test对象中的info对象的value属性,getInfo().getValue();
4.自己写吧
2.Collection是集合类,Collections是工具类。
A.Arraylist查询效率高,增删效率低,线程不安全类
B.HashSet是散列集,即不重复元素
C.TreeSet除不重复元素外,即有自动排序功能,效率较低。
D.区别多的去了,HashTable线程安全,HashMap不是,HashTable不允许null值(key和value都不可 以),HashMap允许null值。这只是些表面的!其他还有很多!
3.来自哪里?没清楚,但:name是要进行显示的bean的名称,而porterty是要显示的属性名称。在没有指定scope时候,会从小范围到大范围的查找。
4.作业自己写!
public static void zhizhu(int x, int y) {
for (int i = x; i <= y; i++) {
int k = 2;
for (; k < i; k++) {
if (i % k == 0)
break;
}
if (k == i || i == 1)
System.out.print(i + " ");
}
}