2015-03-11 06:30:01
阅读( 8 )
选择40题,每题1.5分
考察内容题数
基础类型:如何定义一个十六进制的long变量?1题
位运算(>)1题
finalize方法使用1题
修饰符访问权限(public, protected, default, private)1题
Java对象的周期?(创建,使用,不可达?)1题
Exception1题
二进制IO1题
同步、锁1题
对象的定义1题
Java为啥能跨平台1题
Socket编程1题
序列化1题
GC(如何对某个对象进行垃圾回收)1题
JDBC-ODBC(何时使用JDBC-ODBC桥)1题
JDBC处理顺序1题
集合框架-哪个接口可以存储不重复的数据集合,并按自然顺序排列?1题
集合框架-HashMap与Hashtable的区别1题
Java 编码:选出错误的一个
A. Java用Unicode保存字符及字符串
B. “中文”.getBytes().length一定等于4
C. “中文”.equals(new String(“中文”, “UTF-8″), “UTF-8″)为true
D. “中文”???忘记了1题
try {
ServerSocket server = new ServerSocket(8080);
DatagramSocket socket = new DatagramSocket(8080);
server.accept();
} catch(Exception e) {
e.printStackTrace();
}
System.out.println(“success”); int a = 1, b = 2, c = a * b;
long d = c * 3;
switch(d)
{
case 4:
System.out.println(“c=4″);
case 5:
System.out.println(“c=5″);
case 6:
System.out.println(“c=6″);
default:
System.out.println(“c=default”);
} public class A {
private String str;
public A(String str) {
this.str = str;
}
public static void main(String[] args) {
A a1 = new A(“Hello”);
A a2 = new A(“Hello”);
A a3 = a1;
String s1 = new String(“Hello”);
String s2 = new String(“Hello”);
System.out.println(a1 == a2);
System.out.println(a1.equals(a2));
System.out.println(a1 == a3);
System.out.println(a1.equals(a3));
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
}
} public class Test {
private static String staticField = “A”;
private String field = “C”;
{
System.out.println(field);
System.out.println(“D”);
}
static {
System.out.println(staticField);
System.out.println(“B”);
}
public Test(String str) {
System.out.println(str);
}
public static void main(String[] args) {
new Test(“E”);
}
} float a = 10.0;
System.out.println(a/3); Inner Class的定义 public class A {
public void changeValue(int a) {
this.a += 100;
}
public static void main(String[] args) {
int a = 10;
changeValue(a);
changeValue(a);
changeValue(a);
System.out.println(a);
}
} public class Parent {
public int I = 10;
class Sub extends Parent {
public int I = 20;
}
class Sub2 {
int I = 3;
public static void main(String[] args) {
Parent p1 = new Parent();
Parent p2 = new Sub();
Sub2 s2 = new Sub2();
System.out.println(p1.i + p2.i + s2.i);
}
}
} public class TestThread extends Thread {
public void run() {
// 代码略..
}
public static void main(String[] args) {
Thread thread1 = new TestThread();
System.out.println(“thread(a): ” + thread1.isLive());
thread1.start();
System.out.println(“thread(b): ” + thread1.isLive());
thread1.join();
System.out.println(“thread: ” + thread1.isLive());
}
} public class Test {
public static void method1() throws IOException {
throw new IOException();
}
public static void main(String[] args) throws IOException {
try {
method1();
} catch(IOException e) {
System.out.println(“This is IOException”);
} catch(Exception e1) {
System.out.println(“This is Exception”);
} finally {
System.out.println(“This is finally.”);
}
}
} Servlet好像考了1题? 数据结构-二叉树(结点1001个,叶子结点501个,求度数2结点个数?)1题
数据结构-哈希表(给出哈希函数与值,求插入后位置)1题
数据结构-双向链表(在最后一个元素后插入新元素,并删除最后的元素)1题
HTTP协议1题
SSL1题
在JavaScript中以下哪句是正确的?
A. null instanceOf Object
B. NaN == NaN
C. null === undefined
D. null == undefined1题
UML(读UML图,问意思)1题
填空10空,每空2分
1)用什么修饰声明类属性?(static)
2)用什么修饰方法可以避免子类覆盖该方法?(final)
3)面向对象程序设计的三个基本原则是?(封装,继承,多态)
4)若int a = 1, b = 3,在if(a>b&&a++<5)之后a的值是?
若int a = 1, b = 3,在if(a>b&a++<5)之后a的值是?
5)代码填空(a),(b),(c)。一段读文件写文件的代码。
编程2题,每题10分
1)
① 你知道几种排序算法?列出二个即可。
② 实现一种排序算法,补完以下方法:
public void sort(int[] data) {
}
private void swap(int[] data, int xIndex, int yIndex) {
}
2)实现一个单链表,结点结构为data link,补完以下方法。
public class Link {
private static class Node {
// 补完结构
}
public Link() {}
/**
* 插入一组数据
*/
public Link(Integer[] data) {
// 补完方法
}
/** 返回头结点 */
public Node getHeader() {
// 补完方法
}
/** 打印单链表中的最大值(maxValue)和所在位置(maxIndex) */
public void printMax() {
// 补完方法
}
}
分享给朋友:
亲~ 如果您有更好的答案 可在评论区发表您独到的见解。
您想查看更多的信息:
面试题