登录
首页 » Windows开发 » java异常处理

java异常处理

于 2022-02-14 发布 文件大小:9.00 kB
0 205
下载积分: 2 下载次数: 1

代码说明:

3.8 异常处理  什么是异常  知道Java异常分类  处理异常的两种方式  throw和throws区别  如何创建自定义异常 概念: 在程序中,可能产生程序员没有预料到的各种错误情况,比如打开一个不存在的文件等,在Java中,这种在程序运行时可能出现的错误称为异常。  异常可以把“描述在正常执行过程中做什么事”的代码和“出了问题怎么办”的代码相分离 例子:demo05.ExceptionDemo.java Java异常分类A:  java.lang.Error,java.lang.Exception  Error(错误):jvm系统内部错误、资源耗尽等严重问题,发生Error时,编程人员无能 为力,只能终止程序,例如内存溢出等。  Exception(异常):因编程错误或偶然的外在因素导致的一般性问题,例如:对负数  开平方根、空指针访问等,当发生Exception 时,编程人员可以做出处理,并做出人性 化响应,比如弹出窗口,显示“请不要输入负数!”。 异常分类B:  检查性异常:编译器必须处理的异常,该类异常通常是Exception类型或其子类(RuntimeException类除外)//运行时异常   SQLException、IOException、ClassNotFoundException 例子:/DemoProject/src/com/hyg/demo08/FileInputStreamDemo.java  非检查性异常:编译器不要求强制处理的异常,RuntimeException类及其所有子类都是非检查性异常。   NullPointerException、ClassCastException 例子:equa

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • machine scheduling problems required to give a scheduling program, so as to the...
    多机调度问题要求给出一种作业调度方案,使所给的n个作业在尽可能短的时间内由m台机器加工处理完成。 这个问题是NP安全问题,到目前为止还没有有效的解法。对于这一类问题,用贪心选择策略有时可以设计出较好的近似算法。-machine scheduling problems required to give a scheduling program, so as to the n operations in the shortest possible time by the m-machine processing completed. The problem is NP security issues, so far no effective solution. For this type of issue, greedy strategy can sometimes choose to design a better approximation algorithm.
    2022-03-30 06:33:49下载
    积分:1
  • c语言实现AD采样实验
    c语言实现AD采样实验-AD sampling experiments
    2023-03-08 12:10:04下载
    积分:1
  • c++实现文件的相关操作,文件的读取,文件的写入,打、关闭以及相关操作,还不是很完善哈!...
    c++实现文件的相关操作,文件的读取,文件的写入,打开、关闭以及相关操作,还不是很完善哈!-c++ documents related to the achievement of the operation, the document read, file write, open, closed, and related operations, and Kazakhstan is not very perfect!
    2022-08-26 00:18:06下载
    积分:1
  • COBF (aka C
    COBF (aka C-Obfuscator) is a program which manipulates C or C++ sourcefiles in a way that they aren t readable by human beings but they remain compilable. The benefit of COBF lies in the distribution of programs (freeware, shareware, commercial software etc.): The distribution as a executable binary is often too inflexible (especially for Unix or Windows NT, because it is normally not feasible to support all possible platforms) on the other side one might not give away the sourcecode (e. g. it looks poor [badly commented, Spaghetti code], or you just want to prevent plagiarism). Here COBF can play an important role: It removes all comments and sourcecode formattings and renames all variable and function identifiers. See files.txt for a complete list of the files provided with the cobf zip archive! See doc/ for the COBF manual!
    2022-07-21 12:34:20下载
    积分:1
  • c c++的基本算法及数据结构的实例内容
    c c++的基本算法及数据结构的实例内容-c c++ the basic algorithm and data structure example of the contents of
    2022-08-31 11:25:03下载
    积分:1
  • 孙鑫教程源码 孙鑫视频 教程第5课源码
    孙鑫教程源码 孙鑫视频 教程第5课源码-failed to translate
    2023-05-11 10:55:03下载
    积分:1
  • 一个jQuery网站设计
    A website design with jquery-A website design with jquery..............
    2022-01-26 08:27:46下载
    积分:1
  • 读取dwg文件的dll,这是一个源的项目。有源码的定期维护
    读取dwg文件的dll,这是一个开源的项目。有源码的定期维护-a dll that can read/write dwg file format.
    2022-01-29 03:00:08下载
    积分:1
  • Design using LabVIEW virtual mouse, has a certain reference value
    采用labview设计的虚拟鼠标,有一定参考价值-Design using LabVIEW virtual mouse, has a certain reference value
    2022-03-31 05:07:25下载
    积分:1
  • 数值分析实验题目牛顿迭代法求根 这个也是计算方法中的常用计算程序 学过的人都知道的...
    数值分析实验题目牛顿迭代法求根 这个也是计算方法中的常用计算程序 学过的人都知道的-topic Newton iterative method for solving this calculation method is commonly used in the calculation procedures learned in the people know that the
    2022-02-13 02:55:50下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载