* $Id: SuperClassTest.java ,v 1.1 2010. 9. 8. 오후 2:10:43 smrscvs1 Exp $
* created by : ahn
* creation-date : 2010. 9. 8.
* =========================================================
* Copyright (c) 2010 ManInSoft, Inc. All rights reserved.
*/
public class SuperClassTestA {
@SuppressWarnings("unused")
private String characterAName;
public SuperClassTestA() {
System.out.println("constructor A");
}
public void CharacterTestA() {
characterAName = "parent Name Case 1";
System.out.println(characterAName);
}
public void CharacterTestB(String name) {
this.CharacterTestA();
if(name.equals("")){
name = "parent Name Case 2";
}
System.out.println(name);
}
}
/*
* $Id: SuperClassTestB.java ,v 1.1 2010. 9. 8. 오후 2:11:34 smrscvs1 Exp $
* created by : ahn
* creation-date : 2010. 9. 8.
* =========================================================
* Copyright (c) 2010 ManInSoft, Inc. All rights reserved.
*/
public class SuperClassTestB extends SuperClassTestA{
public SuperClassTestB() {
// TODO Auto-generated constructor stub
System.out.println("constructor B");
}
@Override
public void CharacterTestA(){
System.out.println("Child Class");
}
@Override
public void CharacterTestB(String name){
super.CharacterTestA();
super.CharacterTestB(name);
}
}
/*
* $Id: SuperClassTest.java ,v 1.1 2010. 9. 8. 오후 2:48:11 smrscvs1 Exp $
* created by : ahn
* creation-date : 2010. 9. 8.
* =========================================================
* Copyright (c) 2010 ManInSoft, Inc. All rights reserved.
*/
public class SuperClassTest {
public static void main(String []ages){
SuperClassTestB sup_C_B = new SuperClassTestB();
SuperClassTestA sup_C_A = new SuperClassTestA();
System.out.println("---------------------------------------------");
sup_C_B.CharacterTestB("");
System.out.println("---------------------------------------------");
sup_C_B.CharacterTestA();
System.out.println("#############################################");
sup_C_A.CharacterTestA();
System.out.println("---------------------------------------------");
sup_C_A.CharacterTestB("");
}
}
블라블라...
'JAVA' 카테고리의 다른 글
Date toString() reverse Date() (0) | 2010.12.02 |
---|---|
java reflect private 접근 하기 (0) | 2010.09.13 |
파일 입출력 (0) | 2010.08.23 |
(기타)톰켓 + 다이니믹 웹 (0) | 2010.08.23 |
2. 이제 실제 서플릿 파일이라든지 JSP 그리구, xml설정을 해줄거야 (0) | 2010.08.23 |