请帮我分析一下这道题~~~~~~~~~ In method body, local variable a & b override memeber variable a & b, so you can not access them. If you want to do that, use the key word: this please. For example, this.a & this.b. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void set(int a,int b){Synchronized(b){return this.a=a;this.b=b;}}why is there a retrun statement?(void.) Oh very sorry! that't my falsepublic void set(int a,int b){Synchronized(b){return this.a=a;this.b=b;}}there isn't return 1。a,和b是简单类型,不是对象(不是object的子类)2。你的代码先return了,故此后面的this.b=b不可能运行,所有提示出错。 sychronized只能用在Object和它的派生类上,不能用在primitive类型上。 public void set(int a,int b){Synchronized(b){return this.a=a;this.b=b;}}那个void就不对啊,不能return啊!还有就是你的a和b是基本类型,不是object 请教j2se绘制地图的思路 C转java,面向对象和面向过程能否共存? Play Framework如何通过原生态sql转换成VO对象?!!!! Swing中文API? 如何设置Icon的图片大小 进来再说!!!!嗷~~~~~~~~~ Java Applet聊天室程序 用什么语言薪水最高?? 百思不得其解 关于迭代器的一个问题 请大神说说。。。。。。。。。。。。。。。 哪里可以下载jbuilder7(包括注册机或注册码),所在操作系统是win2000server 关于JAVA程序发布的问题,一定给分,请从事JAVA编程工作的人解答
why is there a retrun statement?(void.)
public void set(int a,int b){Synchronized(b){return this.a=a;this.b=b;}}
there isn't return
2。你的代码先return了,故此后面的this.b=b不可能运行,所有提示出错。
那个void就不对啊,不能return啊!
还有就是你的a和b是基本类型,不是object