Class.forName()
자바에서 클래스의 *동적 로딩 방식을 제공하는 메서드
*프로그램이 실행 중일 때 클래스를 로드하고 객체를 생성하는 방법
매개 변수로 클래스의 경로+이름을 받아들여
해당 클래스를 로드하고,
로드된 클래스의 Class 객체를 반환
ClassNotFoundException을 발생시킬 수도 있어 처리필요
https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/Class.html#forName(java.lang.Module,java.lang.String)
Class (Java SE 19 & JDK 19)
Type Parameters: T - the type of the class modeled by this Class object. For example, the type of String.class is Class . Use Class if the class being modeled is unknown. All Implemented Interfaces: Serializable, Constable, TypeDescriptor, TypeDescriptor.O
docs.oracle.com
'JAVA' 카테고리의 다른 글
| Wrapper, 기본 자료형을 제공하는 클래스 (0) | 2023.03.11 |
|---|---|
| servlet-api.jar란? (0) | 2023.03.11 |
| 자바의 자료구조, collection (0) | 2023.03.11 |
| isELIgnored이란? (0) | 2023.03.10 |
| JSP를 도와주는, action태그 (0) | 2023.03.10 |