filmov
tv
Throws exception handling java programming malayalam tutorial

Показать описание
okay, ഇതാ throws exception handling നെക്കുറിച്ചുള്ള ഒരു വിശദമായ ട്യൂട്ടോറിയൽ, java പ്രോഗ്രാമിംഗിൽ മലയാളത്തിൽ കോഡ് ഉദാഹരണങ്ങൾ സഹിതം:
**എന്താണ് exception handling?**
പ്രോഗ്രാം പ്രവർത്തിക്കുമ്പോൾ ഉണ്ടാകുന്ന runtime errors അല്ലെങ്കിൽ அசாதாரணமான சம்பவங்கள் (exceptions) കൈകാര്യം ചെയ്യുന്ന പ്രക്രിയയാണ് exception handling. exception handling ഉപയോഗിച്ച്, പ്രോഗ്രാം ക്രാഷ് ആവാതെ, പ്രശ്നങ്ങൾ കൈകാര്യം ചെയ്യാനും, പ്രോഗ്രാം സാധാരണ രീതിയിൽ പ്രവർത്തിപ്പിക്കാനും സാധിക്കും.
**java exception hierarchy**
java യിൽ, exceptions ഒരു hierarchical structure പിന്തുടരുന്നു. `throwable` ആണ് ഏറ്റവും മുകളിലുള്ള ക്ലാസ്. ഇതിന് രണ്ട് പ്രധാന subclasses ഉണ്ട്:
* **`exception`**: സാധാരണയായി പ്രോഗ്രാമർമാർക്ക് handle ചെയ്യാൻ കഴിയുന്ന exceptions. ഉദാഹരണത്തിന് `ioexception`, `sqlexception`, `arithmeticexception`.
* **`error`**: സാധാരണയായി പ്രോഗ്രാം handle ചെയ്യാൻ ശ്രമിക്കാത്ത ഗുരുതരമായ പ്രശ്നങ്ങൾ. ഉദാഹരണത്തിന് `outofmemoryerror`, `stackoverflowerror`.
**checked vs. unchecked exceptions**
exceptions പ്രധാനമായി 2 തരമുണ്ട്:
* **checked exceptions**: ഇവ compiler സമയത്ത് പരിശോധിക്കുന്ന exceptions ആണ്. ഒരു മെത്തേഡ് checked exception ഉണ്ടാക്കാൻ സാധ്യതയുണ്ടെങ്കിൽ, അത് `try-catch` block ഉപയോഗിച്ച് handle ചെയ്യണം അല്ലെങ്കിൽ `throws` clause ഉപയോഗിച്ച് declare ചെയ്യണം. `ioexception`, `sqlexception` എന്നിവ ഉദാഹരണങ്ങളാണ്.
* **unchecked exceptions**: ഇവ runtime-ൽ ഉണ്ടാകുന്ന exceptions ആണ്. ഇവ compiler സമയത്ത് പരിശോധിക്കില്ല. `runtimeexception` ക്ലാസ്സിന്റെ subclasses ആണ് ഇവ. ഉദാഹരണത്തിന് `arithmeticexception`, `nullpointerexception`. ഇവ handle ചെയ്തില്ലെങ്കിലും പ്രോഗ്രാം compile ആകും, പക്ഷെ runtime-ൽ exception ഉണ്ടായാൽ പ്രോഗ്രാം terminate ആകും.
**`throws` clause ഉപയോഗിക്കുന്നത് എപ്പോൾ?**
ഒരു മെത്തേഡിന് ഒരു exception handle ചെയ്യാൻ കഴിയില്ലെങ്കിൽ, അത് `throws` clause ഉപയോഗിച്ച് declare ചെയ്യാം. ഇങ്ങനെ ചെയ്താൽ, ആ മെത്തേഡിനെ വിളിക്കുന്ന കോളിംഗ് മെത്തേഡ് ആ exception handle ചെയ്യണം അല്ലെങ്കിൽ വീണ്ടും `throws` ഉപയോഗിച്ച് declare ചെയ്യണം.
**`throws` clause എങ്ങനെ ഉപയോഗിക്കാം?**
`throws` keyword മെത്തേഡ് decl ...
#JavaProgramming #ExceptionHandling #softwaredevelopment
throws exception handling java programming malayalam tutorial try catch finally throw custom exceptions java error handling debugging exception hierarchy runtime exceptions checked exceptions
**എന്താണ് exception handling?**
പ്രോഗ്രാം പ്രവർത്തിക്കുമ്പോൾ ഉണ്ടാകുന്ന runtime errors അല്ലെങ്കിൽ அசாதாரணமான சம்பவங்கள் (exceptions) കൈകാര്യം ചെയ്യുന്ന പ്രക്രിയയാണ് exception handling. exception handling ഉപയോഗിച്ച്, പ്രോഗ്രാം ക്രാഷ് ആവാതെ, പ്രശ്നങ്ങൾ കൈകാര്യം ചെയ്യാനും, പ്രോഗ്രാം സാധാരണ രീതിയിൽ പ്രവർത്തിപ്പിക്കാനും സാധിക്കും.
**java exception hierarchy**
java യിൽ, exceptions ഒരു hierarchical structure പിന്തുടരുന്നു. `throwable` ആണ് ഏറ്റവും മുകളിലുള്ള ക്ലാസ്. ഇതിന് രണ്ട് പ്രധാന subclasses ഉണ്ട്:
* **`exception`**: സാധാരണയായി പ്രോഗ്രാമർമാർക്ക് handle ചെയ്യാൻ കഴിയുന്ന exceptions. ഉദാഹരണത്തിന് `ioexception`, `sqlexception`, `arithmeticexception`.
* **`error`**: സാധാരണയായി പ്രോഗ്രാം handle ചെയ്യാൻ ശ്രമിക്കാത്ത ഗുരുതരമായ പ്രശ്നങ്ങൾ. ഉദാഹരണത്തിന് `outofmemoryerror`, `stackoverflowerror`.
**checked vs. unchecked exceptions**
exceptions പ്രധാനമായി 2 തരമുണ്ട്:
* **checked exceptions**: ഇവ compiler സമയത്ത് പരിശോധിക്കുന്ന exceptions ആണ്. ഒരു മെത്തേഡ് checked exception ഉണ്ടാക്കാൻ സാധ്യതയുണ്ടെങ്കിൽ, അത് `try-catch` block ഉപയോഗിച്ച് handle ചെയ്യണം അല്ലെങ്കിൽ `throws` clause ഉപയോഗിച്ച് declare ചെയ്യണം. `ioexception`, `sqlexception` എന്നിവ ഉദാഹരണങ്ങളാണ്.
* **unchecked exceptions**: ഇവ runtime-ൽ ഉണ്ടാകുന്ന exceptions ആണ്. ഇവ compiler സമയത്ത് പരിശോധിക്കില്ല. `runtimeexception` ക്ലാസ്സിന്റെ subclasses ആണ് ഇവ. ഉദാഹരണത്തിന് `arithmeticexception`, `nullpointerexception`. ഇവ handle ചെയ്തില്ലെങ്കിലും പ്രോഗ്രാം compile ആകും, പക്ഷെ runtime-ൽ exception ഉണ്ടായാൽ പ്രോഗ്രാം terminate ആകും.
**`throws` clause ഉപയോഗിക്കുന്നത് എപ്പോൾ?**
ഒരു മെത്തേഡിന് ഒരു exception handle ചെയ്യാൻ കഴിയില്ലെങ്കിൽ, അത് `throws` clause ഉപയോഗിച്ച് declare ചെയ്യാം. ഇങ്ങനെ ചെയ്താൽ, ആ മെത്തേഡിനെ വിളിക്കുന്ന കോളിംഗ് മെത്തേഡ് ആ exception handle ചെയ്യണം അല്ലെങ്കിൽ വീണ്ടും `throws` ഉപയോഗിച്ച് declare ചെയ്യണം.
**`throws` clause എങ്ങനെ ഉപയോഗിക്കാം?**
`throws` keyword മെത്തേഡ് decl ...
#JavaProgramming #ExceptionHandling #softwaredevelopment
throws exception handling java programming malayalam tutorial try catch finally throw custom exceptions java error handling debugging exception hierarchy runtime exceptions checked exceptions