freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于java的異常處理技術(shù)及其應(yīng)用-資料下載頁

2024-11-16 20:29本頁面

【導(dǎo)讀】本文還就Java異常處理技術(shù)的應(yīng)用做了一些探討,試圖從軟件開發(fā)者的角度。顯得冗長,但是,錯誤檢測和處理仍是任何健壯應(yīng)用程序最重要的組成部分之一。常的具體情況,需要調(diào)用API的程序自己判斷并解釋返回值的含義。其次,它并沒有一種機。的程序員記住去檢測返回值并處理異常情況。這種方式還讓程序代碼變得晦澀冗長,當進。況的switch分支,程序代碼的可讀性變得很差。相對于傳統(tǒng)異常處理方式的缺點,Java異常處理機制提供了很好的解決方案。中出現(xiàn)了什么樣的異常情況[1];而且Java的語言機制保證了異常一定會得到恰當?shù)奶幚?,設(shè)定一個標志,并以此判斷是不是有錯誤產(chǎn)生。隨著系統(tǒng)規(guī)模的不斷擴大,這種錯誤處理。已經(jīng)成為創(chuàng)建大型可維護程序的障礙了。Basic中的異常處理語句“onerrorgoto”,而Java則是在C++基礎(chǔ)上建立了新的異常處理機。在Java中,所有的異常都是以類對象的形式存在的。當一個方法出現(xiàn)異常后便拋出一個異常對象,該對象中包含有異常信息,Throwable是所有異常的基類,

  

【正文】 ,吳功宜 .Java編程技術(shù) .北京:人民郵電出版社, 2020. [6]彭晨陽 .Java實用系統(tǒng)開發(fā)指南 . 北京:機械工業(yè)出版社, 2020. [7]Java 2 Standard Edition Documentation 22 [8 [9]黃聰明 .精通 Java 2 程序設(shè)計 .北京:清華大學(xué)出版社, 2020. [10]Kalthy Sierra,Bert 2學(xué)習(xí)指南 .北京:人民郵電出版社, 2020. [11]耿祥義 .Java基礎(chǔ)教程 .北京:清華大學(xué)出版社, 2020. [12]朱福喜 .Java程序設(shè)計技巧與開發(fā)實例 .北京 :人民郵電出版社, 2020. [13]謝小樂 .J2EE經(jīng)典實例詳解 .北京:人民郵電出版社, 2020. [14] (第三版 ).北京:機械工業(yè)出版社, 2020. [15]Bruce 編程思想 . 北京:機械工業(yè)出版社, 2020. 附 錄 、 源代碼 : import .*。 import .*。 import .*。 public class SwingColorTest extends JFrame { SwingColorControls RGBcontrols, HSBcontrols。 JPanel swatch。 public SwingColorTest() { super(顏色調(diào)和板 )。 setSize(400, 100)。 setDefaultCloseOperation()。 JPanel pane = new JPanel()。 GridLayout grid = new GridLayout(1, 3, 5, 15)。 (grid)。 //使用網(wǎng)格布局 swatch = new JPanel()。 ()。 String[] rgbLabels = { 紅色 , 綠色 , 藍色 }。 RGBcontrols = new SwingColorControls(this, rgbLabels)。 23 String[] hsbLabels = { 色調(diào) , 飽和度 , 亮度 }。 HSBcontrols = new SwingColorControls(this, hsbLabels)。 (swatch)。 (RGBcontrols)。 (HSBcontrols)。 setContentPane(pane)。 pack()。 setVisible(true)。 } //main函數(shù) public static void main(String[ ] arguments) { JFrame frame = new SwingColorTest()。 } //RGB和 HSB的相互轉(zhuǎn) 換 void update(SwingColorControls control) { Color c。 // 從輸入文本框中獲得數(shù)據(jù) int[] value = new int[3]。 for (int i = 0。 i 3。 i++) { value[i] = ([i].getText())。 if ( (value[i] 0) || (value[i] 255) ) { value[i] = 0。 [i].setText( + value[i])。 } } if (control == RGBcontrols) { c = new Color(value[0], value[1], value[2])。 //轉(zhuǎn)化為 HSB float[] hsbValues = new float[3]。 24 float[] HSB = (value[0], value[1], value[2],hsbValues)。 HSB[0] *= 360。 HSB[1] *= 100。 HSB[2] *= 100。 for (int i = 0。 i 3。 i++) { [i].setText(( (int)HSB[i]) )。 } } else { c = ( (float)value[0] / 360, (float)value[1] / 100, (float)value[2] / 100 )。 [0].setText( (()) )。 [1].setText( (()) )。 [2].setText( (()) )。 } //更新圖像顏色 (c)。 ()。 } } class SwingColorControls extends JPanel implements ActionListener, FocusListener { SwingColorTest frame。 JTextField[] setting = new JTextField[3]。 25 SwingColorControls(SwingColorTest parent, String[] label) { frame = parent。 GridLayout cGrid = new GridLayout(3, 2, 10, 10)。 setLayout(cGrid)。 for (int i = 0。 i 3。 i++) { setting[i] = new JTextField(0)。 setting[i].addFocusListener(this)。 setting[i].addActionListener(this)。 JLabel settingLabel = new JLabel(label[i], )。 add(settingLabel)。 add(setting[i])。 } setVisible(true)。 } public void actionPerformed(ActionEvent evt) { if (() instanceof JTextField) (this)。 } public void focusLost(FocusEvent evt) { (this)。 } public void focusGained(FocusEvent evt) { } } The Technique and Application to the Java Exception Handling Abstract: this paper briefly introduces the concepts,administrative levels of exception and the mechanism of applying the structure trycatchfinally to handle the it also explains the methods and steps to make a 26 selfdefinition of exception of exception with also and analyzes technique of Java Exception Handling speaking, this paper discuss Java exception from five sides :throw exceptionnot,seizure exception,stack frame, selfdefinition of exception,the exception of GUI. It also done some discussions on the application of Java exception handling, attempt to state some valuable application in developing of Java software engineering. Keywords: Java Language、 Exception Handling、 JVM
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1