1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package part3.ex6.인터페이스;
 
 
public class Program {
 
    public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
        FileInputStream fis = new FileInputStream("src/part3/ex6/인터페이스/setting.txt");
        Scanner scan = new Scanner(fis);        
        String className = scan.nextLine();
        scan.close();
        fis.close();
        
        Class clszz = Class.forName(className);
        A a = new A();
        X x = (X) clszz.newInstance();
        a.setX(x);
        
        a.print();
    }
 
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

 

출처 : https://www.youtube.com/watch?v=YZzpGtpW2h0&list=PLq8wAnVUcTFX4E2NplMvJfqlcgAeF_BxK&index=33

+ Recent posts