小编Toa*_* Le的帖子

如何从一天开始获得毫秒数

例如,如果是下午1点(13:00),我需要以毫秒为单位获得数字46800000(从开始日起13小时).有人可以帮忙吗?

java android date timer

4
推荐指数
1
解决办法
3254
查看次数

如何终止子线程的父线程?

如何从我创建的子线程中终止父(主)线程?我试过System.exit(1),但它只终止子线程.我也尝试在main的while循环中设置一个条件,但显然会在退出之前尝试读取1个额外的输入.

public static void main(String[] args) throws IOException
{
    new Thread(new Runnable() 
    { 
      public void run() 
      { 
        while(true) 
        { 
            //meet a condition then terminate
        } 
      } 
    }).start(); 
    while (true)
    {
        String a = input.nextLine();
        //do something with input
    }
}
Run Code Online (Sandbox Code Playgroud)

java concurrency multithreading exit

2
推荐指数
1
解决办法
2460
查看次数

标签 统计

java ×2

android ×1

concurrency ×1

date ×1

exit ×1

multithreading ×1

timer ×1