ImageVerifierCode 换一换
格式:DOCX , 页数:28 ,大小:20.64KB ,
资源ID:5952278      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-5952278.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(几个陷阱题Word下载.docx)为本站会员(b****2)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

几个陷阱题Word下载.docx

1、NO.3 长整除public class LongDivision final long MICROS_PER_DAY = 24 l* 60 * 60 * 1000 * 1000; /微秒 final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000; /毫秒 System.out.println(MICROS_PER_DAY/MILLIS_PER_DAY);NO.4 互换内容public class Swap int x = 1984; int y = 2001; x= y= x=y; System.out.println(x= + x + ; y= + y

2、); 陷阱等级:NO.5 字符串和字符public class CharAndString H + a); System.out.println(H + apublic class CharAndString public static void main(String args) System.out.println( System.out.println( NO.6 字符数组public class CharArray String letters = ABC char numbers = 1, 23; System.out.print(numbers); System.out.print

3、(letters + easy as +numbers);public class CharArray String letters = char numbers = System.out.print(letters + NO.7 转义字符public class UnicodeTest au0022.length() +u0022b.length();public class UnicodeTest 陷阱等级:NO.8 打印输出类名public class MyClass System.out.println(MyClass.class.getName().replaceAll(.,/) +

4、 .classpublic class MyClass NO.9 随机数的问题import java.util.Random;public class RandomTest private static Random rnd = new Random(); StringBuffer word = null; switch(rnd.nextInt(2) case 1: word = new StringBuffer(P case 2:G default:M word.append(in System.out.println(word);public class RandomTest NO.10

5、无情的增量操作public class ForTest int j = 0; for (int i = 0; i 100; i+) j = j+; System.out.println(j);public class ForTest NO.11 整数边界的问题public class WhileTest public static final int END = Integer.MAX_VALUE; public static final int START = END - 100; int count = 0; for (int i = START;= END; i+) count+; Sy

6、stem.out.println(count);public class WhileTest int count = 0; for (int i = START; count+; System.out.println(count);NO.12 计数器的问题public class Clock int minutes = 0; for (int ms = 0; ms 0) out.write(buf, 0, n); if (in != null) in.close(); if (out != null) out.close();public class IOTest 5、无限循环 view pl

7、aincopy to clipboardprint?public static final int END = Integer.MAX_VALUE;public static final int START = END - 100;public static void main(String args) int count = 0;for (int i = START;count+;System.out.println(count); 上面程序运行的结果是什么?A:无限循环。将i=END改成iEND?为什么呢?你知道的,呵呵!6、计数器问题 int minutes = 0;for (int m

8、s = 0;if (ms % 60*1000 = 0) minutes+;System.out.println(minutes);结果跟你想的一样么?A:呵呵,括号问题,不多说!7、到底返回什么?public static boolean decision() try return true; finally return false;true?false?一般情况下,不管怎么说try/catch代码块中,finally总是最后被执行的 。8、错误里聚集遍历 Vector v = new Vector();v.add(onetwothreefourEnumeration enume = v.e

9、lements();while (enume.hasMoreElements() String s = (String) enume.nextElement();if (s.equals() v.remove(else System.out.println(s);System.out.println(Whats really there.enume = v.elements();运行代码看看结果跟你想的一样么?一般不建议在遍历聚集的时候对聚集进行操作。为什么结果是这样呢?看JDK源码能得到答案。Enumeration没有实现Fail Fast操作,如果换成ArrayList,上面的代码可能会出错。java与模式迭代子(iterator)介绍了。public String substring(int beginIndex, int endIndex) if (beginIndex count) throw new StringIndexOutOfBoundsException(endIndex); if (beginIndex endIndex) throw new StringIndexOutOfBoundsException(endI

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2