![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
面试题
iteye_10289
这个作者很懒,什么都没留下…
展开
-
面试题(用栈代替队列的操作和原生map实现)
是skype电话面试,先行记录下来,总共有两道:1. 通过栈的操作实现队列的操作:即 用栈的基本方法push pop 实现 出队和入队的方法难点在于在不给出提示的情况下,能不能想出使用两个栈来实现队列操作。 (1) 先将stack1 的所有数据pop,然后push至stack2 。 (2) 取出stack2 的顶部元素, 实现出队操作。 (3) 将stack2的...2014-04-03 17:12:48 · 183 阅读 · 0 评论 -
面试题 (斐波那契数列,复杂度为线性)
来自网易的一道看似简单的笔试题题目:要求以线性时间复杂度实现斐波那契数列。1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 。。。。。。 众所周知的斐波那契实现方式为递归实现:int feb1(int n) { t1++; if(n == 0 || n == 1) return 1; return feb1(n-1) + feb1(n-2...2014-04-03 21:36:19 · 164 阅读 · 0 评论 -
面试题 数组长度可否赋值
public class ArrayLength { public static void main(String[] args) { String a[] = new String[10]; a.length = 15; System.out.println(a.length); }} 数组长度不能赋值,在编译器中会造成编译错误:The fina...原创 2013-03-07 10:06:05 · 541 阅读 · 0 评论 -
面试题 异常的抛出和捕获
public class ExceptionTest { public static void main(String[] args) { int i = 0; try { if(i == 0) { throw new IOException(); } } catch (IOException e) { System.out.prin...原创 2013-03-07 14:41:24 · 116 阅读 · 0 评论 -
面试题 java类加载机制
public class SuperA { public void printX(){ System.out.println("hello superA!"); }} public class SuperB extends SuperA { public void printY(){ System.out.println("hello superB!");...原创 2013-03-07 16:33:35 · 151 阅读 · 0 评论 -
java 子类和父类中方法的引用
public class SuperA { public SuperA(){ printX(); } public void printX(){ System.out.println("hello superA!"); }} public class SuperB extends SuperA { public SuperB(){ pri...原创 2013-03-07 18:58:32 · 287 阅读 · 0 评论 -
java 静态变量的用法
public class T1 { public static int a=0; public int b=0;} public class T2 { public static void main(String[] args) { T1 t1 = new T1(); T1 t2 = new T1(); t1.a++; t2.a++; ...原创 2013-03-08 00:08:39 · 162 阅读 · 0 评论 -
java 中文件outputstream的操作注意
public class FileTest { public static void main(String[] args) { File file = new File("F:\\3.txt"); if(!file.exists()) { try { file.createNewFile(); } catch (IOException e) { ...原创 2013-03-08 00:08:53 · 438 阅读 · 0 评论 -
ConcurrentHashMap<K, V>的实现
哈希表存储模型 与Map接口中的内部Entry<K, V>接口(键值对)不同,ConcurrentHashMap在其基础上,自己规定了内部类HashEntry<K, V> static final class HashEntry<K,V> { final K key; final int hash...2014-07-20 16:28:41 · 182 阅读 · 0 评论