(Learning memo) Java 2nd grade measures: Q4 main points (exception handling)

Java Self-learning notes

Question 4 Summary of points

Get knowledge about exception handling

When designing a program You need to be prepared for the possibility of unexpected errors at runtime: writing_hand:

① try (processing that may cause an exception) ② catch block (catch the exception you want to handle) ③ Finally block (processing performed regardless of whether an exception has occurred) --If you have either catch or finally, you can omit one.

--The try-catch block cannot be described in the finally block. --Multiple finally blocks cannot be described.

--If you want to throw exception handling to the calling class without handling it yourself It is OK (convenient) if you write ** thows exception class name ** in the method signature.

try{
Statement executed if there are no errors
}catch (exception class variable name){
Exception handling (statement executed at the time of exception)
}

What are the exception classes? ■ Error exception: No need to catch with try-catch ■ Exception type exception: If you do not catch it with try-catch, a compile error will occur. ■ RuntimeException-type exception: It is OK with or without catching with try-catch!

try{
Statement executed if there are no errors
}catch (exception class variable name){
Exception handling (statement executed at the time of exception)
}finally{
Process to be executed regardless of whether there are exceptions
}

--------- TBE -------------

Recommended Posts

(Learning memo) Java 2nd grade measures: Q4 main points (exception handling)
(Learning memo) Java 2nd grade measures: Q5 main points (calculation results)
(Learning memo) Java Level 2 measures: Question range
Java exception handling?
[Java] Exception handling
☾ Java / Exception handling
Java exception handling
Java exception handling
Java 3rd grade measures Q1 Past question point summary
Java learning memo (method)
Java learning memo (basic)
Java learning memo (interface)
Java learning memo (inheritance)
(Learning memo) Java 2nd grade measures: Q5 main points (calculation results)
(Learning memo) Java 2nd grade measures: Q4 main points (exception handling)
(Learning memo) Java Level 2 measures: Question range
java basic knowledge memo
Java learning memo (method)
Java learning memo (basic)
Java learning memo (interface)
Java learning memo (inheritance)
Java 3rd grade measures Q1 Past question point summary
Java learning memo (data type)
Java learning memo (logical operator)
Java learning memo (abstract class)
Java learning memo (creating an array)
Java learning memo (while statement, do-while statement)
Java basic learning content 7 (exception)
Java learning memo (data type)
[Java] Practice of exception handling [Exception]
[Java] About try-catch exception handling
Java exception handling usage rules
Java learning memo (logical operator)
Java learning memo (abstract class)
Exception handling techniques in Java
Java learning memo (creating an array)
[In-house study session] Java exception handling (2017/04/26)
Step-by-step understanding of Java exception handling
[For Java beginners] About exception handling