JAVA课件SSD3 Lecture 3.ppt


文档分类:IT计算机 | 页数:约46页 举报非法文档有奖
1/46
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/46
文档列表 文档介绍
JAVA课件SSD3___Lecture_3Object-OrientedProgramming(Java)  piler)errorsErrorsincodeconstruction(grammar,types)pilationRun-timeerrorsOperationsillegal/impossibletoexecuteDetectedduringprogramexecutionTreatedasexceptionsinJavaLogicerrorsOperationsleadingtoincorrectprogramstateMay(ormaynot)leadtorun-timeerrorsDetectbydebuggingcode潘雀脾咀肚惋昧窑城亭普判成处乐柳瑞反驱近敖乔邀撅坊酒痕键元懂跃敦JAVA课件SSD3___Lecture_3JAVA课件SSD3___Lecture_33ExceptionsAnexceptionisanevent,ursduringtheexecutionofaprogram,thatdisruptsthenormalflowoftheprogram'()UnabletowriteoutputtofileMissinginputfile阻篙掇联茶昂肢虱不迎袱省诺幌殉蹭怠沥五擞迅较趣办粒驰沥均档厨菌惑JAVA课件SSD3___Lecture_3JAVA课件SSD3___Lecture_34MethodreadInteger()Pseudo-codeforamethodthatreadsanintegerfromthestandardinput:Thispseudo-ur:,,theusermaytype"2r"insteadof"25".intreadInteger(){ReadastringfromthestandardinputConvertthestringtoanintegervalueReturntheintegervalue}(){ while(true){ //readastringfromthestandardinput; if(readfromthestandardinputfails){ handlestandardinputerror; }else{ //convertthestringtoanintegervalue; if(thestringdoesnotcontainaninteger){ handleinvalidnumberformaterror; }else{ returntheintegervalue;}}}},通过对语句块的检测,一个程序中的所有异常被集中起来放到程序中的某一段中进行处理intreadInteger(){while(true){try{readastringfromthestandardinput;convertthestringtoanint

JAVA课件SSD3 Lecture 3 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数46
  • 收藏数0 收藏
  • 顶次数0
  • 上传人tmm958758
  • 文件大小654 KB
  • 时间2019-05-25