例外处理科特林

代码示例

3
0

试图赶上科特林

try{
  // wirte here somethin that you thought it would throw expection
}
catch(e:Expection){ 
  e.printstacktrace() 
  // handle expection or write upper line of code
}
finally{
	// this block is optional 
  	// this will always run if expection come or not
}
1
0

科特林扔异常

throw Exception("Exception message")

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................