fork(1) download
  1. class main
  2. {
  3. /*
  4.   描画する絵を選択する処理
  5.   int i = checkInputKey(); //入力されたキー番号を取得
  6.  
  7.   */
  8.  ThreadClass tc = new ThreadClass("tc"); //カレントスレッド名を渡す
  9. tc.setThread(tc); //Thread情報を渡す
  10. tc.setDrawPattern(i); //描画するパターンiを渡す
  11.  tc.start(); //Thread起動
  12. }
  13.  
  14. //スレッド
  15. public class ThreadClass extends HandlerThread implements Runnable
  16. {
  17. ThreadClass(String s)
  18. {
  19. super(s);
  20. }
  21.  
  22.  public void run()
  23.  {
  24. Looper.prepare();
  25. Handler hi = new Handler(tc.getLooper()); //メインスレッドのルーパー貰う
  26. //※起動してみたら↑で止まる
  27. //tc.getLooper()を外せば止まらずプログラムは走るが、↓のRunが起動せず終了する
  28.   hi.post(new Runnable() {
  29.    public void run () {
  30.     //描画処理
  31.    }
  32.   });
  33.  }
  34.  
  35. public void setThread(ThreadClass t)
  36. {
  37. tc = t;
  38. }
  39. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: illegal character: \12288
?ThreadClass tc = new ThreadClass("tc");	//????????????
^
Main.java:8: ';' expected
?ThreadClass tc = new ThreadClass("tc");	//????????????
 ^
Main.java:8: <identifier> expected
?ThreadClass tc = new ThreadClass("tc");	//????????????
               ^
Main.java:9: <identifier> expected
  tc.setThread(tc);	//Thread?????
              ^
Main.java:9: <identifier> expected
  tc.setThread(tc);	//Thread?????
                 ^
Main.java:10: <identifier> expected
  tc.setDrawPattern(i);	//????????i???
                   ^
Main.java:10: <identifier> expected
  tc.setDrawPattern(i);	//????????i???
                     ^
Main.java:11: illegal character: \12288
?tc.start();		//Thread??
^
Main.java:11: ';' expected
?tc.start();		//Thread??
 ^
Main.java:11: illegal start of type
?tc.start();		//Thread??
   ^
Main.java:21: illegal character: \12288
?
^
Main.java:22: illegal character: \12288
?public void run()
^
Main.java:23: illegal character: \12288
?{
^
Main.java:28: illegal character: \12288
??hi.post(new Runnable() {
^
Main.java:28: illegal character: \12288
??hi.post(new Runnable() {
 ^
Main.java:28: ';' expected
??hi.post(new Runnable() {
    ^
Main.java:29: illegal character: \12288
???public void run () {
^
Main.java:29: illegal character: \12288
???public void run () {
 ^
Main.java:29: illegal character: \12288
???public void run () {
  ^
Main.java:29: <identifier> expected
???public void run () {
   ^
Main.java:29: ';' expected
???public void run () {
         ^
Main.java:29: invalid method declaration; return type required
???public void run () {
               ^
Main.java:30: illegal character: \12288
????//????
^
Main.java:30: illegal character: \12288
????//????
 ^
Main.java:30: illegal character: \12288
????//????
  ^
Main.java:30: illegal character: \12288
????//????
   ^
Main.java:31: illegal character: \12288
???}
^
Main.java:31: illegal character: \12288
???}
 ^
Main.java:31: illegal character: \12288
???}
  ^
Main.java:32: illegal character: \12288
??});
^
Main.java:32: illegal character: \12288
??});
 ^
Main.java:33: illegal character: \12288
?}
^
32 errors
stdout
Standard output is empty