Lesson 31 of 34
Exceptions: Errors കൈകാര്യം ചെയ്യൽ
10 min 30 XP
പ്രോഗ്രാം പ്രവർത്തിക്കുമ്പോൾ error (exception) സംഭവിച്ചാൽ അത് crash ആകും. അപകടസാധ്യതയുള്ള കോഡ് try-നുള്ളിൽ വെച്ച് error catch-ൽ കൈകാര്യം ചെയ്യൂ. finally എപ്പോഴും പ്രവർത്തിക്കും.
Example: edit me and press Run
Press Run to see the result here.throw ഉപയോഗിച്ച് നിങ്ങൾക്ക് തന്നെ exception ഉയർത്താം, ഉദാഹരണത്തിന് ഒരു method-ന് തെറ്റായ value ലഭിക്കുമ്പോൾ.
Example: edit me and press Run
Press Run to see the result here.Checked exceptions (IOException പോലുള്ളവ) compile time-ൽ കൈകാര്യം ചെയ്യണം; unchecked (RuntimeException) വേണ്ട. Interviews-ന് ഈ വ്യത്യാസം വളരെ ഇഷ്ടമാണ്.