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 ಗೆ ಈ ವ್ಯತ್ಯಾಸ ತುಂಬಾ ಇಷ್ಟ.