+ 4

NEED OF EXCEPTION IN JAVA

(1) exception handling means we will slove runtime error(0r exception)those occurred during program execution. (2)if program terminate abnormally,we will lose previously entered all values and all transection. (3) exception handling means it's logical error example:- Facebook explation:- if we enter wrong user name and password that time brower not closed page ...catch error and show on screen.. exception divided into two sub type.. 1.error 2.exception runtime exception following..:- 1.arithmatic exception 2.nullpointerexception 3.indexoutofboundexception

21st Sep 2018, 11:25 AM
Rameshwar Shivshette
Rameshwar Shivshette - avatar
6 Antworten
+ 2
Exceptions are use to avoid abnormal termination of program, while executing.
20th Oct 2018, 12:34 PM
Jayesh Patil
Jayesh Patil - avatar
0
Please provide a link to your Code Playground code so we can help you troubleshoot the specific issues you are running into. The Code Playground should be relatively easy to find in the website version of SoloLearn, but if you are in the app version, it can be accessed via the curly braces, green circle with plus sign to add a new project, then select the project type. Looking forward.
21st Sep 2018, 1:24 PM
Janning⭐
Janning⭐ - avatar
0
Exceptions in Java have this structure: try { // code that throws an exception } catch (Exception e) { // code that run when an exception occurs } "Exception" is the generic class, you can insert a predefined exception like NullPointerException or an exception written by your own.
22nd Sep 2018, 8:11 AM
Leonardo Medai Cossutta
Leonardo Medai Cossutta - avatar
0
you can also manually throw exceptions
22nd Sep 2018, 2:31 PM
iJustErik gah
iJustErik gah - avatar
0
Wooooowww
18th Oct 2018, 12:13 AM
Kurniawan Adi Saputra
Kurniawan Adi Saputra - avatar
- 1
Better to say there is Throwable, which is extended by Exception and Error. Typically you don’t need to catch Errors (they mean something is too wrong and we cannot do anything with this). Exceptions may be caught and the program may recover after it. RuntimeExceptions usually mean there some bug in the code (like NullPointerException, IllegalStateException...). Typically they are also not caught. Exceptions just state something went wrong (password is wrong, file cannot be opened, program failed to connect to the server or failed to get data from it, the last issue results in for example famous 404 error in browsers, for example; without a catch block browser would have died after an exception) P.S. Avoid catch (Exception e), catch only what you need (IOException, SocketException...)
22nd Sep 2018, 10:09 PM
Dmitry