class NestTry { public static void main(String args[]){ try{ int a = args.length; int b - 42 / a; System.out.println("a=a" + a); try{ if (a == 1) a = a / (a - a); if (a == 2) { int c[] = {1}; c[42] = 99; } } catch(ArrayIndexOutOfBoundException e) { System.out.println("ΠΠ½Π΄Π΅ΠΊΡ Π·Π° ΠΏΡΠ΅Π΄Π΅Π»Π°ΠΌΠΈ ΠΌΠ°ΡΡΠΈΠ²Π°: " + e); } } catch(ArithmeticException e) { System.out.println("ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π½Π° Π½ΡΠ»Ρ: " + e); } } } QUESTION 1:
What does code mean?
if (a == 1) a = a / (a - a)? if (a == 2)? What is a = a / (a - a)? ΠΠ°ΠΊΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ a ΠΎΡΠ½ΠΎΡΠΈΡΡΡ ΠΊ prescribed for a = a / (a - a)? ΠΠ°ΠΊΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ a ΠΎΡΠ½ΠΎΡΠΈΡΡΡ ΠΊ a = a / (a - a)? ΠΠ°ΠΊΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ a ΠΎΡΠ½ΠΎΡΠΈΡΡΡ ΠΊ s , Π²Π΅Π΄Ρ c `is an array?
int c[] = {1}; c[42] = 99; QUESTION 2:
What is the difference between throw and throws ?
QUESTION 3:
for which we write in this code again throw new IllegalAccessException("Π΄Π΅ΠΌΠΎΠ½ΡΡΡΠ°ΡΠΈΡ"); ?
class ThrowsDemo{ static void throwOne() throws IllegalAccessException { System.out.println(" Π ΡΠ΅Π»Π΅ ΠΌΠ΅ΡΠΎΠ΄Π° throwOne(al)."); throw new IllegalAccessException("Π΄Π΅ΠΌΠΎΠ½ΡΡΡΠ°ΡΠΈΡ"); } public static void main(String args[]{ try{ throwOne(); } catch(IllegalAccessException e) { System.out.pritln("ΠΠ΅ΡΠ΅Ρ
Π²Π°ΡΠ΅Π½ΠΎ ΠΈΡΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅: " + e); } } }