小编Ref*_*ack的帖子

java中的签名和未签名数据类型

关于Java支持哪些无符号数据类型,我有点困惑?

我读过这篇文章,但我不明白其非常复杂的解释(至少对我而言).

java types

15
推荐指数
2
解决办法
4万
查看次数

如何预测输出中的线程ID?

以下是OCJP考试的代码

class Test implements Runnable{

  synchronized void hit(long n) {
     for(int i = 1; i < 3; i++)
        System.out.print(n + "-" + i + " ");
  }

  public static void main(String... args) throws Exception{   
     new Thread(new Test()).start();
     new Thread(new Test()).start();
  }

  @Override
  public void run() {
     hit(Thread.currentThread().getId());
  }
}
Run Code Online (Sandbox Code Playgroud)

答案:8-1 7-1 7-2 8-2和

8-1 8-2 7-1 7-2

如何预测这个输出?

java multithreading

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

标签 统计

java ×2

multithreading ×1

types ×1