[Java] Java exception handling

1 minute read

[Java exception handling]

It is a memo of Java exception handling used in business. I have summarized it because it is used during development.

Java has a convenient feature called exception handling

Exceptions occur during unusual special conditions when running a Java program. Exception processing is executed when an exception occurs.

As an aside, I thought that the program structure of exception handling was visually easy to understand, like an if statement.

try-catch-finally syntax

// Exception handling syntax

  // Processing that may cause an exception;
} catch (exception class variable name){
  //Process to be executed when an exception occurs (processing that is not performed unless an exception occurs);
} finally {
  //Process that is always executed at the end regardless of whether there is an exception

Normal execution is only try block. When an exception occurs, the process immediately moves to the catch block.

  • A stack trace is information that records the sequence in which the JVM calls program methods and where an exception occurs.


At present, most SE operations include creating specifications in Excel and responding to emails. ..

Under such circumstances, I am doing my best while thanking you for being involved in Java development.