20일차 강의 정리


소스

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Pm01{//extends Object
//    public Pm01(){    //숨어있는 아가들
//        super();
//        System.out.println("pm01 클래스 생성자");
//    }
    void func01(){
        System.out.println("Pm01 class func01() call");
    }
}
 
public class Ex01 {
    public static void main(String[] args) throws Exception {
        //Object
        Object obj = new Object();
        Pm01 pm01 = new Pm01();
        
        System.out.println(pm01.toString());
        System.out.println(pm01);
        System.out.println("pm01클래스의 해시코드: "+pm01.hashCode());
        System.out.println("pm01클래스의 경로: "+pm01.getClass());
        pm01.func01();
        System.out.println("------------------------");
        
        //리플렉션
        Class info = Class.forName("com.hb.pm.Pm01");
        Object obj2 = info.newInstance();
        Pm01 pm02 = (Pm01)obj2;
        
        System.out.println(pm02.getClass());
        pm02.func01();
 
    }//main end
}//class end
cs

결과



'* Programming > JAVA' 카테고리의 다른 글

DAY21 싱글톤 패턴  (0) 2016.08.02
DAY20 Calendar/Date/Random/Arrays Class  (0) 2016.08.02
DAY20 this/super  (0) 2016.08.02
DAY19 익명클래스  (0) 2016.08.02
DAY19 내부클래스,로컬클래스  (0) 2016.08.01

+ Recent posts