출처는 http://www.kkaok.pe.kr/ 에서 까오기님이 만드신겁니다.

http://www.kkaok.pe.kr/servlet/KBoard?cmd=view&tableName=kfree&flag=0&search=&findword=&gotoPage=1&seq=617

저도 이렇게 컴파일하고 싶은데

NoGirlException과 DontHaveMoneyException이 나네요;ㅁ;

예전에는 DontTimeException이 나더니;ㅁ; TimePool이 널널해지니 저런 에러가;ㅁ;

어디 참한 아가씨 있으면 소개좀;ㅁ;

=================================================================================================================

수정 버전...

웬만하면 v1.1로 하고 클래스 패스에 전화번호 걸어주고

컴파일해서 잘 써여

^^



package oldboys;

import Girl;

public class MakeGirlFriends Extends Girl
{
    public static MakeGirlFriends instance;
    private Girl beautyGirl;

    static synchronized public MakeGirlFriends getInstance() {
        if (instance == null) {
            instance = new MakeGirlFriends();
        }
        return instance;
    }

    private MakeGirlFriends() {
        beautyGirl  = new Girl();
    }

    public Girl getGirlFriends() {
        String query    = "나다 밤길 어두운데 왠만하면 하나 시켜도~~";
        Connection conn = null;
        Statement stmt  = null;
        ResultSet rs    = null;
        try{
            conn = phone.call();
            stmt = conn.Speeking();
            rs   = stmt.executeQuery(query);
            if(rs.next()){
              beautyGirl.setGirlName(rs.getString("girlName"));
              beautyGirl.setPhoneNumber(rs.getString("phoneNumber"));
            }

        }catch(Exception e){
            System.out.println("넌 칭구도 아냐!!! 잘먹고 잘살아라"+e.toString());
        }
        return beautyGirl;
    }
}

아래는 여자분들의 반발로 인해 ....

package single;

import singleMan;

public class MakeFriends
{
    // 세가지만 맞으면 된다. 외모, 능력, 성격 별거 아님
    public static NormalHuman getMan(String str) throws Exception
        if(str.equals("그놈"))
          return new MakeGirlFriendsImpl();
        else
          return new MakeBoyFriendsImpl();
    }
}

------------------------------------------------------------------
package single;

import NormalHuman;

public class MakeGirlFriendsImpl implements NormalHuman
{
    private NormalHuman beautyGirl;

    private MakeGirlFriends() {
        beautyGirl  = new NormalHuman();
    }

    public NormalHuman getGirlFriends() {
        String query    = "나다 밤길 어두운데 왠만하면 하나 시켜도~~";
        Connection conn = null;
        Statement stmt  = null;
        ResultSet rs    = null;
        try{
            conn = phone.call();
            stmt = conn.Speeking();
            rs   = stmt.executeQuery(query);
            if(rs.next()){
              beautyGirl.setGirlName(rs.getString("girlName"));
              beautyGirl.setPhoneNumber(rs.getString("phoneNumber"));
            }

        }catch(Exception e){
            System.out.println("넌 칭구도 아냐!!! 잘먹고 잘살아라"+e.toString());
        }
        return beautyGirl;
    }
}


------------------------------------------------------------------
package single;

import NormalHuman;

public class MakeGirlFriendsImpl implements NormalHuman
{
    private NormalHuman handsomeGuy;

    private MakeGirlFriends() {
        handsomeGuy  = new NormalHuman();
    }

    public NormalHuman getBoyFriends() {
        String query    = "난데 뭐하니? 잘지내? 애는 잘 크구, 혼자 잘먹고 잘사니 좋으냐? 노는 시동생 소개좀 시켜도";
        Connection conn = null;
        Statement stmt  = null;
        ResultSet rs    = null;
        try{
            conn = phone.call();
            stmt = conn.Speeking();
            rs   = stmt.executeQuery(query);
            if(rs.next()){
              handsomeGuy.setGirlName(rs.getString("girlName"));
              handsomeGuy.setPhoneNumber(rs.getString("phoneNumber"));
            }

        }catch(Exception e){
            System.out.println("넌 칭구도 아냐!!! 잘먹고 잘살아라"+e.toString());
        }
        return handsomeGuy;
    }
}

=======

사용 방법

package oldboys;



import manyGirl;



public class MakeGirlFriends Extends Girl
{
    public static MakeGirlFriends instance;
    private Girl beautyGirl;

    static synchronized public MakeGirlFriends getInstance() {
        if (instance == null) {
            instance = new MakeGirlFriends();
        }
        return instance;
    }

    private MakeGirlFriends() {
       beautyGirl  = introductionToFriend();
    }

    public Girl introductionToFriend() {
        String query    = "나다 밤길 어두운데 왠만하면 하나 시켜도~~";
        Connection conn = null;
        Statement stmt  = null;
        ResultSet rs    = null;
        beautyGirl      = new Girl();
        try{
            conn = phone.call();
            stmt = conn.Speeking();
            rs   = stmt.executeQuery(query);
            if(rs.next()){
             beautyGirl.setGirlName(rs.getString("girlName"));
             beautyGirl.setPhoneNumber(rs.getString("phoneNumber"));
            }

        }catch(Exception e){
            System.out.println("넌 칭구도 아냐!!! 잘먹고 잘살아라"+e.toString());
        }
        return beautyGirl;
    }
}