电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

Java中常见错误和异常解决方法(打印)

Java中常见错误和异常解决方法(打印)_第1页
1/41
Java中常见错误和异常解决方法(打印)_第2页
2/41
Java中常见错误和异常解决方法(打印)_第3页
3/41
1.java.lang.NullPointerException 原因是:有空指针,有地址没赋值 2.Exception in thread "main" java.lang.ArithmeticException: / by zero 原因是除数是0 3.ArrayIndexOutOfBoundsException 原因是:数组越界 4.java.lang.NumberFormatException 原因是:数字格式化有问题 5.Unhandled exception type Exception 原因是:没有进行异常处理 6. 进行国际化操作的时候遇到这样的错误:Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Message, locale zh_CN 答:因为在命令提示符中,是没有错误的 解决方法是:在myeclipse 中,会出现这个错误 java 国际化之Can't find bundle for base name 1.初步学习 最近在学习ResourseBundle 时遇到了“Can't find bundle for base name ”这个错误搞了很久才解决了。原因就是类路径问题要将属性文件放在类路径中!百度里很多都是教程但没有涉及到解决方法! 2.中文显示: 测试文件 java 代码 package com.lht.ResourseBundleStudy; import java.util.ResourceBundle; public class ResourseBundleDemo { public static void main(String[] args) { ResourceBundle resource = ResourceBundle.getBundle("test"); System.out.print(resource.getString("msg0") + "!"); System.out.println(resource.getString("msg1") + "!"); } } test.properties msg0="Hello World" msg1="da jia hao" 开始自己测试的时候:将属性文件放在bin/下也试过也不行无赖中就在google 中搜索了一下终于在sun 的java 论坛 (http://forum.java.sun.com/thread.jspa?threadID=660477&messageID=4231534)中找到了线索下面是帖子的内容: I've solved the problem the best way possible. Basically what i've done is added a new class folder named config to the project home dir. Then i added this classfolder to the classpath in project properties. After doing all of this you only need to reference the properties file by "Email". Hope this helps anyone else who is having similiar problems. 基本意思就是在src 下建立classes(名字无所谓)文件夹将属性文件存放在下面,然后将这个文件夹加...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

Java中常见错误和异常解决方法(打印)

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部