关于java线程的问题 java 线程thread 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static void manin(String args[])改为public static void main(String args[]) package demo.spli;public class ThreadTerminate { public static void main(String args[])throws Exception{//楼主把main方法写错了 int i=0; Hello h=new Hello(); Thread t =new Thread(h); t.setPriority(Thread.MAX_PRIORITY); t.start(); System.out.println("Please stop"); h.stopRunning(); while(i<5){ System.out.println("Good Morning"+i++); } }}class Hello implements Runnable{int i=0;private boolean timeToQuit=false;public void run(){while(!timeToQuit){System.out.println("Holle"+i++);try{if(i%2==0)Thread.sleep(10);}catch(Exception e){}}}public void stopRunning(){timeToQuit=true;}} JAVA SOCKET和C# TCPCLIENT通信的问题 求CardLayout的例程? Java Applet中如何加入事件监听 java 乱码问题请求解决! 向数据库插入特别慢 阻塞的问题 服务器端用Socket接受数据,bufferedreader的read方法读当数组当中。接收数据包时,有的数据包服务器端没有显示收到,这是为什么? 怎么在Fram窗体中怎样划线 请问怎样在两个frame之间传递信息?谢谢50分 紧急求救----如何用java编游戏杆的接口程序??????? 生产者消费者线程问题 ListView相关问题,ItemX代表一个项目X,点击后出现对应可编辑描述
改为
public static void main(String args[])
package demo.spli;public class ThreadTerminate {
public static void main(String args[])throws Exception{//楼主把main方法写错了
int i=0;
Hello h=new Hello();
Thread t =new Thread(h);
t.setPriority(Thread.MAX_PRIORITY);
t.start();
System.out.println("Please stop");
h.stopRunning();
while(i<5){
System.out.println("Good Morning"+i++);
}
}
}class Hello implements Runnable{
int i=0;
private boolean timeToQuit=false;
public void run(){
while(!timeToQuit){
System.out.println("Holle"+i++);
try{
if(i%2==0)
Thread.sleep(10);
}catch(Exception e){}
}
}
public void stopRunning(){
timeToQuit=true;
}
}