Exceptions in Java
Në shqip: Përjashtimet në Java
ShpjegimiSQ
Java-ja i trajton gabimet me exceptions: kodin e rrezikshëm e fut në try, gabimin e kap në catch. Disa exception-e janë „checked“ — kompajleri të detyron t'i trajtosh ose t'i deklarosh me throws.
EnglishEN
Java handles errors with exceptions: risky code goes in try, the error is caught in catch. Some exceptions are “checked” — the compiler forces you to handle them or declare them with throws.
Si ta mendosh
Si portieri pas mbrojtjes — vetëm se në Java gjyqtari (kompajleri) s'e nis ndeshjen nëse s'ke vënë portier për disa gjuajtje.
Lexoje në anglisht
Like the goalkeeper behind the defence — except in Java the referee (the compiler) won't start the match unless you've put a keeper in for certain shots.
Shembull kodijava
try {
int rezultati = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Nuk pjesëtohet me zero!");
}