Exception Handling ->
Thursday, 3 July 2025 4:36 PM
Exception -> Unpredict error -> run time -> normal flow of execution khrb hojaeye
User Market
Petrol
Mechanism to handle run time error so that the normal flow of execution can be maintained
cart order
Tracking -> GPS ->
pay
Sorry for the error -> delvier
s
menu
track
Compiler ->
Python State 1
Node js State 2
State 3
State 4
State 5
State 6
Try{
State 7 // galat hai
}
Catch{
Syso -> "Sorry for the error"
}
Finally {
State 6
Try{
State 7 // galat hai
}
Catch{
Syso -> "Sorry for the error"
}
Finally {
}
State 8
Exception Handling ->
1. Checked
a. IO Exception , SQL Exception , ClassNotFound Exception
2. Unchecked ->
a. Arrayindexoutofbound , arthimetic 0/10 , String ; 0>
3. Error
a. Stackoverflow , NoClassDefine , outofMemoryError
Paise do ?
Ghar
Return kroge ->
User Charger le ana
Bike ->
To Handle Exception ->
1. Try Block -> jis part of code m apko lgtha hai error aa sakthi hai
2. Catch Block -> aagr try block wale code m error aati hai toh on the spot catch block trigger hojaega
3. Finally Block -> aagr error ho ya na ho -> finally block always executable hai
Throw Throws
When u want to throw exception Method signature -> Declare in method -> function -> throws
explicitly activate krde
Customized Galti , function , block ,
body
Throw Throws
When u want to throw exception Method signature -> Declare in method -> function -> throws
explicitly activate krde
Customized Galti , function , block ,
body
Final Finally Finalize
Final keyword Exception Method
Variable -> Whether try block consist After java 1.8 -> finalize deprecated ->
1. Reassign Of error or not -> finally will Garbage collector -> perform clean when
2. Kahi diff sub class always executed Object is of no use
3. Inc/dec nhi kr sakthe
4. Unchangable