Differenze tra le versioni di "Programmazione:Java/Exception"

Da WikiSitech.
Vai alla navigazioneVai alla ricerca
 
Riga 3: Riga 3:
  
 
Usare eccezioni '''checked''' per essere sicuro che qualcuno le intercetti
 
Usare eccezioni '''checked''' per essere sicuro che qualcuno le intercetti
 
 
|- valign="top"
 
|- valign="top"
 
|width="50%"|
 
|width="50%"|
 
 
<code java>
 
<code java>
 
void function() {
 
void function() {
Riga 12: Riga 10:
 
}
 
}
 
</code>
 
</code>
 
 
|valign="top" |
 
|valign="top" |
 
 
<code java>
 
<code java>
 
void function() throws CheckedException{
 
void function() throws CheckedException{
Riga 20: Riga 16:
 
}
 
}
 
</code>
 
</code>
 
 
|}
 
|}

Versione delle 12:21, 31 ott 2007

Exception

Usare eccezioni checked per essere sicuro che qualcuno le intercetti

void function() {

  throw new RuntimeException("");

}

void function() throws CheckedException{

  throw new CheckedException("");

}