三道笔试题

楼主
三道笔试题
[P] 三道笔试题 [/P][P][B]1、改错题(指出错误之处并对其进行修改)[/B][/P][P][B]  1.1、下列代码的错误之处[/B][/P][P][B]  --[/B][/P][P][B]  --[/B][/P][P] 1 public class Question1 { 2     /** 3      * 判断是否为奇数 4      * @param i 5      * @return true 为奇数 false 为偶数 6      */ 7     public static boolean isOdd(int i){ 8         return i%2==1; 9     }10     /**11      * @param args12      */13     public static void main(String[] args) {14         for(int i=Integer.MIN_VALUE;i<=Integer.MAX_VALUE;++i){15             boolean isOdd=isOdd(i);16             System.out.println(String.format("i=%d,isOdd=%b", i, isOdd));17         }18     }19 }  [/P][P][B]  1.2、下列代码的错误之处[/B][/P][P][B]  --[/B][/P][P][B]  --[/B][/P][P]1 public class Question2 {2     public static void main(String[] args) {3         final long MICROS_PER_DAY=24*60*60*1000*1000;4         final long MILLIS_PER_DAY=24*60*60*1000;5         System.out.println(MICROS_PER_DAY/MILLIS_PER_DAY);6     }7 }[P][URL=javascript:void(0);][/URL][/P][/P][P][B]  1.3、下列代码的错误之处[/B][/P][P][B]  --[/B][/P][P][B]  --[/B][/P][P]1 public class Question3 {2     public static void main(String[] args) {3         for(byte b=Byte.MIN_VALUE;b<Byte.MAX_VALUE;b++){4             if(b==0x90)5                 System.out.println("Joy!");6         }7     }8 }[P][URL=http://www.cnblogs.com/gw811/archive/2012/10/17/2727109.html][/URL][/P][P][URL=javascript:void(0);][/URL][/P][/P][P] [/P]

电脑版 Page created in 0.0312 seconds with 2 queries.