好多问题哦???

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

1,怎么把wtk或者手机厂商的sdk添加到jcreator下??  
  2,testrunnable 这个程序里面有两个线程(thread1.start   和thread2.start),thread1.start起动run后,进入无限循环,为什么还可以运行thread2呢?  
  3,usetabbedpane里面最后的那具类有什么作用啊?  
  4,用jcreator 可不可以像jbuilder那样自动生成代码?  
  5,在java里面怎么样获取日期??  
  6,用jcreator这个东西可不可以开发j2me啊  
  7,bufferedreader这个是什么类型的对象啊???  
  8,是不是用system.in.read()这个方法输入数据后,不用换行,系统就会自动换行??  
  9,为什么用system.in.read()这个方法输入数据不能输入字符串和整型数据啊?好像就  
  只能输入字符这一种数据类型.    
  11,如何用filedialog这个类的对象保存文件???和打开文件???  
   
   
  import   java.applet.applet;  
  import   java.awt.*;  
  public   class   testrunnable   extends   applet   implements   runnable  
  {  
    label   prompt1=new   label("第一个子线程");  
    label   prompt2=new   label("第二个子线程");  
    textfield   threadfirst=new   textfield(14);  
    textfield   threadsecond=new   textfield(14);  
    thread   thread1,thread2;  
    int   count1=0,count2=0;  
  public   void   init()  
  {  
  add(prompt1);  
  add(threadfirst);  
  add(prompt2);  
  add(threadsecond);  
  }  
  public   void   start()  
  {  
  thread1=new   thread(this,"firstthread");  
  thread2=new   thread(this,"secondthread");  
  thread1.start();  
  thread2.start();  
  }  
  public   void   run(){  
    string   currentrunning;  
    while(true)  
  {  
  try{  
  thread.sleep((int)(math.random()*30000));  
  }  
  catch(interruptedexception   e){}  
  currentrunning=thread.currentthread().getname();  
      if(currentrunning.equals("firstthread"))  
      {  
    count1++;  
      threadfirst.settext("线程1第"+count1+"次被调度");  
  }  
  else   if(currentrunning.equals("secondthread"))  
      {  
      count2++;  
      threadsecond.settext("线程2第"+count2+"次被调度");  
  }  
  }  
  }  
  }  
   
 

· 网友精彩回答:

发表者:cuilichen

首先告诉楼主,你的这个程序不是j2me的。  
   
  线程的问题是因为cpu会为各个线程分配时间,所以第二个线程也可以运行。第一个线程是无限循环,只能说明cpu会一直为它分配时间,但是,不能阻止cpu为其他的线程分配时间。

发表者:xueyong1203

yun  
  j2se的咚咚都是

发表者:mailbomb

还有很长的路要走啊

发表者:archer_xy

其实这么多问题我也不能讲得很清楚,怕误人子弟啊,多看书,多写,会渐渐明白的。努力ing

发表者:xiaoqin99

楼主+u

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved