Back-End Programming Exam  >  Back-End Programming Videos  >  Java Programming Fundamentals: For Beginners (in Hindi)  >  Lecture 34 Explicit throw an exception in java Hindi

Lecture 34 Explicit throw an exception in java Hindi Video Lecture | Java Programming Fundamentals: For Beginners (in Hindi) - Back-End Programming

75 videos

FAQs on Lecture 34 Explicit throw an exception in java Hindi Video Lecture - Java Programming Fundamentals: For Beginners (in Hindi) - Back-End Programming

1. जावा में explicit exception कैसे थ्रो किया जाता है?
उत्तर: जावा में explicit exception थ्रो करने के लिए हमें 'throw' की कीवर्ड का उपयोग करना होता है। इसके लिए हमें अपनी कस्टम exception class के एक object को create करना होता है और फिर उसे 'throw' की कीवर्ड के साथ थ्रो कर देना होता है। थ्रो किए गए exception को catch करने के लिए हमें try-catch ब्लॉक का उपयोग करना होता है।
2. क्या exception को थ्रो करने के बाद catch ब्लॉक execute होता है?
उत्तर: हां, जब एक exception थ्रो किया जाता है तो catch ब्लॉक execute होता है। जब थ्रो किए गए exception का टाइप catch ब्लॉक में मिल जाता है, तब catch ब्लॉक को execute किया जाता है और उसमें दिए गए statements को चलाया जाता है। अगर catch ब्लॉक में exception का टाइप नहीं मिलता है, तो यह exception uncaught हो जाता है और program terminate हो जाता है।
3. जब हम एक exception थ्रो करते हैं, तो फिर इसका क्या होता है?
उत्तर: जब हम एक exception थ्रो करते हैं, तो control आपके program के उस भाग पर जाता है जहां यह exception catch किया जा सकता है। यदि program में थ्रो किए गए exception का catch ब्लॉक मौजूद नहीं है, तो program terminate हो जाता है।
4. क्या हम एक exception को catch नहीं कर सकते?
उत्तर: हां, हम एक exception को catch नहीं कर सकते। अगर हम एक exception को catch नहीं करते हैं, तो वह uncaught exception हो जाता है और program terminate हो जाता है।
5. क्या हम एक exception को catch करने के लिए एक से अधिक catch ब्लॉक लगा सकते हैं?
उत्तर: हां, हम एक exception को catch करने के लिए एक से अधिक catch ब्लॉक लगा सकते हैं। जब एक exception थ्रो किया जाता है, तो Java runtime catch ब्लॉक के टाइप के अनुसार उचित catch ब्लॉक को ढूंढता है और उसे execute करता है। यह catch ब्लॉक catch ब्लॉक की श्रंखला के रूप में लगा सकते हैं, ताकि एक ही exception को अलग-अलग तरीकों से handle किया जा सके।
75 videos
Explore Courses for Back-End Programming exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Summary

,

Exam

,

Extra Questions

,

video lectures

,

Lecture 34 Explicit throw an exception in java Hindi Video Lecture | Java Programming Fundamentals: For Beginners (in Hindi) - Back-End Programming

,

Free

,

Sample Paper

,

practice quizzes

,

Semester Notes

,

ppt

,

MCQs

,

Objective type Questions

,

Important questions

,

Lecture 34 Explicit throw an exception in java Hindi Video Lecture | Java Programming Fundamentals: For Beginners (in Hindi) - Back-End Programming

,

shortcuts and tricks

,

past year papers

,

Viva Questions

,

mock tests for examination

,

study material

,

pdf

,

Previous Year Questions with Solutions

,

Lecture 34 Explicit throw an exception in java Hindi Video Lecture | Java Programming Fundamentals: For Beginners (in Hindi) - Back-End Programming

;