首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

分享:某组织Java笔试题(二)

2013-07-08 
分享:某单位Java笔试题(二)接 http://wwwcomy.iteye.com/blog/1855251 上篇文章[list]15.下面程序的运行结

分享:某单位Java笔试题(二)
接 http://wwwcomy.iteye.com/blog/1855251 上篇文章

[list]15.下面程序的运行结果是什么?(考察正则表达的,不难)

package com.iteye.test;public class Test {public static void main(String[] args) {System.out.println(Test.class.getName().replaceAll(".", "/") + ".class");}}
16.请提供一个对i的声明,使下面循环变为无限循环:
while(i!=i){}

对JS熟悉的都知道NaN,但是在Java里面还真没用过,没想到基本类的包装类还真有这个。。
Double.NaN和Float.NaN,注意要用基本类型声明。 (再看看NaN是怎么得出来的吧 0.0d/0.0,这个可以研究研究)
double i = Double.NaN;
17.看程序写结果:
public class PingPong {public static synchronized void main(String[] a) {Thread t = new Thread() {public void run() {pong();}};t.run();System.out.print("Ping");}static synchronized void pong() {System.out.print("Pong");}}

Java解惑里面的乒乓,没啥问题。18.++i和i++的问题,考试必有。。。这个不多说了,一搜一大把代码:
static void test() {int j = 0;for (int i = 0; i < 100; i++) {j = j++;}System.out.println(j);}
19.实现BIO方式的Socket服务端客户端。这个写两次就知道怎么回事儿了,不难。20.题没看懂,略。。21.如何判断PDF是否带毒。。。没答。22.如何找出两个单向链表的第一个公共节点。23.用户要求你在生产机上的数据库加个字段,你该怎么办。24.如何判断一个整数是否在给定的40E个没排序的unsigned int整数当中?25.实现递归和非递归的斐波那契额数列。这个也不难,看过动态规划的都知道。26.Hadoop相关姿势:三种运行模式,M-S模式的节点功能,容错特性体现在哪里等等。
[/list] 1 楼 瓶鱼跃 2013-04-28   楼主只给题目不给答案啊!··· 2 楼 wwwcomy 2013-04-28   瓶鱼跃 写道楼主只给题目不给答案啊!···

=.= 有些写了答案了

代码相关的 我个人感觉你最好自己跑一跑,背下答案好像对个人能力提升不大。。

其实有题目了,谷歌一下很容易就有答案,还能加深印象~ 3 楼 八岭书生 2013-04-28   double i = Double.NaN; 

可以查看jdk源码

Double类

/**
     * Returns <code>true</code> if the specified number is a
     * Not-a-Number (NaN) value, <code>false</code> otherwise.
     *
     * @param   v   the value to be tested.
     * @return  <code>true</code> if the value of the argument is NaN;
     *          <code>false</code> otherwise.
     */
    static public boolean isNaN(double v) {
return (v != v);
    }

热点排行