1. Java中集合类型包含ArrayList,LinkedList,HashMap等类,下面描述错误的是( )
A. ArrayList和LinkedList均实现了List接口
B. 添加和删除元素时,ArrayList的表现更佳
C. ArrayList的访问速度比LinkedList快
D. HashMap的实现MAP接口,它允许任何类型的键和值对象并允许将null作为键或值
2. 0.6332的数据类型是( )
A. float B. double C. Float D. Double
3.下面程序的输出是( )
String s1 = new String("hello");
String s2 = "hello";
System.out.print(s1 == s2);
System.out.print(",");
System.out.print(s1.equals(s2));
A. true, false B. false,true C. false,false D. true,true
4. 请写出下面程序的输出
public class Example {
String str = new String("good");
char[] ch = { 'a', 'b', 'c' };
public static void main(String args[]) {
Example ex = new Example();
ex.change(ex.str, ex.ch);
System.out.print(ex.str + " and ");
System.out.print(ex.ch);
}
public void change(String str, char ch[]) {
str = "test ok";
ch[0] = 'g';
}
}
**5.请写出下面程序的输出 **
public class Person {
String name;
public Person() {
print();
}
public Person(String name) {
this.name = name;
print();
}
public void print() {
System.out.println("p:" + name);
}
public static void main(String[] args) {
new Child("kitty");
}
}
class Child extends Person {
Person father;
public Child(String name) {
System.out.println("new child");
this.name = name;
father = new Person("F:" + name);
print();
}
@Override
public void print() {
System.out.println("c:" + name);
}
public Child() {
print();
}
}
6.创建线程的有哪几种方式?
7.请写一个单例类。
8.请使用Java语言实现冒泡算法。
9.请画出TCP/IP协议的三次握手过程。