I have a question about JAVA EXCEPTION!

Asked 2 years ago, Updated 2 years ago, 75 views

Hello, everyone

I'm a beginner developer.

I'm asking you this question because there's no way to find it during the development of the program.

Java development is currently springing.

When the controller calls a function in another class and an error occurs

I created a logic that handles errors on a different controller.

What I'm curious about is that the controller wants to know the class or function name where the error occurred

I don't know from a beginner's point of view, so I'd like to ask for advice from masters like this.

Help the poor novice developer ㅠ<

exception java

2022-09-21 22:58

2 Answers

Java provides an exception handling mechanism called try catch.

I have to write it very explicitly, so it's very annoying.

If you want to know where it came from, you can display the stack trace in the catch section.

try{
...
...
}catch(Exception ex){
    ex.printStackTrace();
}

If you do, you can track where the exception occurred.


2022-09-21 22:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.