Core Java اسئلة واجوبة المقابلات
Question: What is Checked Exception and its use in java?Answer:Checked Exception in Java is all those Exception which requires being catches and handled during compile time. If Compiler doesn’t see try or catch block handling a Checked Exception, it throws Compilation error. All the Exception which are direct sub Class of Exception but not inherit RuntimeException are Checked Exception. Use of Checked Exception: 1) All Operation where chances of failure is more e.g. IO Operation, Database Access or Networking operation can be handled with Checked Exception. 2) When you know what to do (i.e. you have alternative) when an Exception occurs, may be as part of Business Process. 3) Checked Exception is a reminder by compiler to programmer to handle failure scenario. Example of checked Exception in Java API Following are some Examples of Checked Exception in Java library:
|
احفظ للمراجعة
احفظ هذا العنصر في الإشارات المرجعية، او حدده كصعب، او ضعه في مجموعة مراجعة.
سجل الدخول لحفظ الإشارات المرجعية والاسئلة الصعبة ومجموعات المراجعة.
هل هذا مفيد؟ نعم لا
الاكثر فائدة حسب تقييم المستخدمين:
- How could Java classes direct program messages to the system console, but error messages, say to a file?
- What are the differences between an interface and an abstract class?
- Why would you use a synchronized block vs. synchronized method?
- How can you force garbage collection?
- What are the differences between the methods sleep() and wait()?