I am stuck here please help me🙏 Can an exception be handled only in the current function? Explain. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am stuck here please help me🙏 Can an exception be handled only in the current function? Explain.

6th Dec 2018, 10:53 AM
Mehak Jain
7 Answers
+ 9
Yes, with the exception of any finally blocks, or if there is an exception handler within the function that can catch the type of exception you're throwing. But unless you catch it or have a finally block: try { var foo = 42 /0; } finally { // This will execute after the exception has been thrown }
6th Dec 2018, 2:58 PM
AKS
AKS - avatar
0
You need negative or positive value
20th Dec 2018, 9:35 AM
Hassan Raed
Hassan Raed - avatar
0
For example - 1 negative
20th Dec 2018, 9:36 AM
Hassan Raed
Hassan Raed - avatar
0
Ok
20th Dec 2018, 9:37 AM
Hassan Raed
Hassan Raed - avatar
0
But please 10 minuts
20th Dec 2018, 9:37 AM
Hassan Raed
Hassan Raed - avatar
0
Sorry I'm in working
20th Dec 2018, 1:46 PM
Hassan Raed
Hassan Raed - avatar
0
Int a; Cin>>a; If(a>=0) { Cout<<a<< "negative number" <<endl; Else Cout<<a<<"positive number" <<endl;
20th Dec 2018, 1:52 PM
Hassan Raed
Hassan Raed - avatar