
잘만 구현하면 좋은 프로그램을 만들수있겠다~~ ^0^
[Test.java]
interface Listener
{
public void startListener(String log);
public void runListener(String log);
}
class Test2 implements Listener {
public synchronized void startListener(String log) {
System.out.println("Bclass started:"+log);
}
public synchronized void runListener(String log) {
System.out.println("Bclass running:"+log);
}
Test2() {
Bclass myb = new Bclass(this);
Thread thread = new Thread(myb);
thread.start();
}
public static void main(String[] args) {
Test2 t2 = new Test2();
}
}
----------------------------------------------------------------------------
[Bclass.java]
public class Bclass implements Runnable{
private Listener listener;
private int i = 0;
Bclass(Listener l) {
this.listener = l;
this.listener.startListener ("메롱이당 ㅋㅋㅋ 요이땅~~~");
}
public void run() {
while (true) {
this.i++;
try{Thread.sleep(10);}catch (Exception e) {}
this.listener.runListener(i+"--나지금 돌고 있니~ ㅋㅋㅋㅋ");
}
}
}
· 삼성 애니콜 SPH-P9000 2006/11/24
· 오늘자 데스크탑 스크린샷 듀얼모니터 (XP + Ubuntu) 2008/10/24
· HP iPAQ rw6800 2007/01/25
· 이번에 기변한 삼성 애니콜 sph-m4500 pda폰 2007/08/21
· [긴급공지] 페이지 카운터 다운되었습니다... 2007/12/01
· ShortCutCall ppc에서 전화바로걸기 단축아이콘 2006/10/23
· @세대 [At Generation] 2007/06/25
· 리눅스에서 자바 버전 표시가 설치한 버전으로 안나올경우 2008/05/23
· 투데이스크린 iphone아이콘화면되면 딱인데... 2007/01/16
· ThinkPad R52 공장 초기화하기 2007/05/04




