Throwable cause 가 뭘까?
RuntimeException(String message, Throwable cause)
message= 에러 메세지를 알려준다.
Throwable cause = 에러가 난 파일을 알려준다.
public class RuntimeException extends Exception {
@java.io.Serial
static final long serialVersionUID = -7034897190745766939L;
public RuntimeException() {
super();
}
public RuntimeException(String message) {
super(message);
}
public RuntimeException(String message, Throwable cause) {
super(message, cause);
}
public RuntimeException(Throwable cause) {
super(cause);
}
protected RuntimeException(String message, Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
static final long serialVersionUID = -7034897190745766939L;
기본적으로 자동생성
객체를 파일에 쓰거나 전송하기 위해서는 직렬화를 해야 하는데 그러기 위해 객체 클래스에 Serializable 인터페이스를 implements 하게 된다.
serialVersionUID 는 직렬화에 사용되는 고유 아이디인데, 선언하지 않으면 JVM에서 디폴트로 자동 생성된다.
참고
https://whitekeyboard.tistory.com/496
https://madplay.github.io/post/java-serialization