Would you like to react to this message? Create an account in a few clicks or log in to continue.

ҧ Threads Ẻ implements Runnable

 :: ¹ҡѹ :: ѡѺ Threads

Go down

ҧ Threads Ẻ implements Runnable Empty ҧ Threads Ẻ implements Runnable

ตั้งหัวข้อ  Admin Thu May 22, 2008 11:14 pm




package
threads;

public class runnable implements Runnable {


@Override
public void run() {

}

public static void main(String[] args) {

}

}

Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ҧ Threads Ẻ implements Runnable Empty Re: ҧ Threads Ẻ implements Runnable

ตั้งหัวข้อ  Admin Thu May 22, 2008 11:27 pm





package
threads;

public class runnable implements Runnable {


@Override
public void run() {

}

public static void main(String[] args) {

}

}



¡
[quote="Admin"]package threads;

public class runnable implements Runnable {

private String name;


@Override
public void run() {

for(int i=1;i
Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ҧ Threads Ẻ implements Runnable Empty Ẻ extends Thread

ตั้งหัวข้อ  Admin Thu May 22, 2008 11:31 pm

package threads;

public class extendsThread extends Thread {

private String name;


@Override
public void run() {

for(int i=1;i<=20;i++)
System.out.println(name+" : "+i);
}



public extendsThread(String name) {
this.name = name;
}


public static void main(String[] args) {

// Thread t1 = new Thread(new extendsThread("A")); // Ẻ 1.
// new Thread(new extendsThread("B")).start(); // Ẻ 2.

// Ẻ new
new extendsThread("C").start();
new extendsThread("B").start();
new extendsThread("A").start();
}

}
Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ҧ Threads Ẻ implements Runnable Empty Re: ҧ Threads Ẻ implements Runnable

ตั้งหัวข้อ  Admin Thu May 22, 2008 11:37 pm

new extendsThread("C").start();
new extendsThread("B").start();

new extendsThread("A").start();

ѧࡵؤѹ return ͡

Admin พิมพ์ว่า:
Thread t1 = new extendsThread("C").start();
Thread t2 = new extendsThread("B").start();

Thread t3 =new extendsThread("A").start();

-------------------------------------------Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Type mismatch: cannot convert from void to Thread
Type mismatch: cannot convert from void to Thread
Type mismatch: cannot convert from void to Thread

at threads.extendsThread.main(extendsThread.java:28)

Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน

- Similar topics

 :: ¹ҡѹ :: ѡѺ Threads

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ