各位大侠!求教一个线程的问题。
public class ClustererPanel
{
protected long m_TestTime;
protected void startClusterer()
{
try{
if (m_RunThread == null) {
m_StartBut.setEnabled(false);
m_StopBut.setEnabled(true);
m_RunThread = new Thread() {
public void run() {
m_TestTime=2;
System.out.println("In Thread m_TestTime:"+m_TestTime);
}
};
m_RunThread.setPriority(Thread.MIN_PRIORITY);
m_RunThread.start();
}
}catch (Exception)
{
}
System.out.println("Out of the Threadm_TestTime:"+m_TestTime);
//打印结果是Out of the Threadm_TestTime:0
// In Thread m_TestTime:2
// 假如想在这里得到m_TestTime=2的值,或者是想使得打印结果是Out of the
// Threadm_TestTime:0应该怎么样来做呢?
}
}