可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

public class Threads 1


public class Threads 1 {  intx=0;  public class Runner implements Runnable {  public void run() {  int current = 0;  for(int=i=0;i<4;i++){  current = x;  System.out.print(current + “, “);  x = current + 2;  }  }  }  public static void main(String[] args) {  new Threads1().go();  }  public void go() {  Runnable r1 = new Runner();  new Thread(r1).start();  new Thread(r1 ).start();  }  }  Which two are possible results?()

  • A 0, 2, 4, 4, 6, 8, 10, 6,
  • B 0, 2, 4, 6, 8, 10, 2, 4,
  • C 0, 2, 4, 6, 8, 10, 12, 14,
  • D 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14,
  • E 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14,
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、1. public class ArrayT

1.&ensp;public&ensp;class&ensp;ArrayTest&ensp;{&ensp;2.&ensp;public&ensp;static&ensp;void&ensp;main&ensp;(String[]args)&ensp;&ensp;{&ensp;3.&ensp;float&ensp;f1[],...

2、public class Threads4 

public&ensp;class&ensp;Threads4&ensp;{&ensp;public&ensp;static&ensp;void&ensp;main&ensp;(String[]&ensp;args)&ensp;{&ensp;new&ensp;Threads4().go();&ensp;}&ensp...

3、public class Threads3 

public&ensp;class&ensp;Threads3&ensp;implements&ensp;Runnable&ensp;{&ensp;public&ensp;void&ensp;run()&ensp;{&ensp;System.out.print(running);&ensp;}&ensp;public&...

4、public class Threads2 

public&ensp;class&ensp;Threads2&ensp;implements&ensp;Runnable&ensp;{&ensp;public&ensp;void&ensp;nun()&ensp;{&ensp;System.out.println(run.);&ensp;throw&ensp;new&...

5、1. public class X&ensp

1.&ensp;public&ensp;class&ensp;X&ensp;{&ensp;2.&ensp;public&ensp;static&ensp;void&ensp;main&ensp;(String[]args)&ensp;&ensp;&ensp;{&ensp;3.&ensp;int&ensp;[]&ensp;a&...

6、public class Threads5 

public&ensp;class&ensp;Threads5&ensp;{&ensp;public&ensp;static&ensp;void&ensp;main&ensp;(String[]&ensp;args)&ensp;{&ensp;new&ensp;Thread(new&ensp;Runnable()&ens...