SCJP问题(6)-关于线程 肯定是E啦,线程由cpu随机调配,结果不能确定的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 QUESTION 61 Exhibit :1. public class SyncTest{2. public static void main(String[] args) {3. final StringBuffer s1= new StringBuffer();4. final StringBuffer s2= new StringBuffer();5. new Thread () {6. public void run() {7. synchronized(s1) {8. s2.append("A");9. synchronized(s2) {10. s2.append("B");11. System.out.print(s1);//这个没输出12. System.out.print(s2);13. }14. }15. }16. }.start();17. new Thread() {18. public void run() {19. synchronized(s2) {20. s2.append("C");21. synchronized(s1) {22. s1.append("D");23. System.out.print(s2);24. System.out.print(s1);//这个输出D25. }26. }27. }28. }.start();29. }30. }怎么都没答案,楼主是不是抄错啊? 急啊。。。集合或者数组里面存对象,怎么在数组里面获取到对象的属性,在线等 请教各位大哥,帮我参考下形势,走还是留? java 最新的版本 支持 goto 语句么? 文件输入输出流 一个查询sql Socket接收网页表单提交中文无法正常显示 在一个包中的类要调用同包中的接口和类,编译的时间出现问题,应该怎么解决??? JAVA内部培训光盘资料,需要速联系QQ:65212235 java applet 中画线粗细如何控制? 关于java下的import 如何通过applet的权限封锁,实现读取客户硬件断口? 除了sun以外,那里下载jdk1.5比较快?
1. public class SyncTest{
2. public static void main(String[] args) {
3. final StringBuffer s1= new StringBuffer();
4. final StringBuffer s2= new StringBuffer();
5. new Thread () {
6. public void run() {
7. synchronized(s1) {
8. s2.append("A");
9. synchronized(s2) {
10. s2.append("B");
11. System.out.print(s1);//这个没输出
12. System.out.print(s2);
13. }
14. }
15. }
16. }.start();
17. new Thread() {
18. public void run() {
19. synchronized(s2) {
20. s2.append("C");
21. synchronized(s1) {
22. s1.append("D");
23. System.out.print(s2);
24. System.out.print(s1);//这个输出D
25. }
26. }
27. }
28. }.start();
29. }
30. }
怎么都没答案,楼主是不是抄错啊?