求 c# 和 java 的线程的用法 和语法!! 请教高手门了~~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class MyThread extends Thread { int count= 1, number; public MyThread(int num) { number = num; System.out.println("创建线程 " + number); } public void run() { while(true) { System.out.println("线程 " + number + ":计数 " + count); if(++count== 6) return; } } public static void main(String args[]) { for(int i = 0; i 〈 5; i++) new MyThread(i+1).start(); }} using System;using System.Threading;using System.Security.Permissions;public class ThreadWork {public static void DoWork() {try {for(int i=0; i<100; i++) { Console.WriteLine("Thread - working."); Thread.Sleep(100); } }catch(ThreadAbortException e) { Console.WriteLine("Thread - caught ThreadAbortException - resetting."); Console.WriteLine("Exception message: {0}", e.Message); Thread.ResetAbort(); } Console.WriteLine("Thread - still alive and working."); Thread.Sleep(1000); Console.WriteLine("Thread - finished working."); }}class ThreadAbortTest {public static void Main() { ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork); Thread myThread = new Thread(myThreadDelegate); myThread.Start(); Thread.Sleep(100); Console.WriteLine("Main - aborting my thread."); myThread.Abort(); myThread.Join(); Console.WriteLine("Main ending."); }} c# 可以直接是一个方法来调用,委托Java 必须要写一个类来着 el 表达式 里 equals 与==的区别 自学以后如何入行 有关Alfresco的求助!!! OGNl的问题 smtp 在有些书中如struts kick start中使用value object传递数据,难道直接使用formbean不是一样吗? Java与.NET 部署deploy.wsdd文件时,出错!!求救!!!! jbuilder中jsp文件的改名问题请教 高手请进,《Enterprise JavaBeans》第一个bean的发布问题! EJB3 在weblogic里面如何修改oracle的连接数 <ec:table>鼠标经过事件
int count= 1, number;
public MyThread(int num) {
number = num;
System.out.println("创建线程 " + number);
}
public void run() {
while(true) {
System.out.println("线程 " + number + ":计数 " + count);
if(++count== 6) return;
}
}
public static void main(String args[]) {
for(int i = 0; i 〈 5; i++) new MyThread(i+1).start();
}
}
using System.Threading;
using System.Security.Permissions;public class ThreadWork {
public static void DoWork() {
try {
for(int i=0; i<100; i++) {
Console.WriteLine("Thread - working.");
Thread.Sleep(100);
}
}
catch(ThreadAbortException e) {
Console.WriteLine("Thread - caught ThreadAbortException - resetting.");
Console.WriteLine("Exception message: {0}", e.Message);
Thread.ResetAbort();
}
Console.WriteLine("Thread - still alive and working.");
Thread.Sleep(1000);
Console.WriteLine("Thread - finished working.");
}
}class ThreadAbortTest {
public static void Main() {
ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork);
Thread myThread = new Thread(myThreadDelegate);
myThread.Start();
Thread.Sleep(100);
Console.WriteLine("Main - aborting my thread.");
myThread.Abort();
myThread.Join();
Console.WriteLine("Main ending.");
}
}
Java 必须要写一个类来着