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 కు ఈ తేడా చాలా ఇష్టం.