请帮我分析一下这道题~~~~~~~~~ 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 求证一下 primitive type 都有继承Object的语意吗? 空指针问题 对象初始化。 大家帮忙看看这个算法的题目该怎么写啊??? 请教java对线程的销毁操作 多维数组问题 请给个用XERCES创建XML的例子 时间的问题?请指教 如何将一个值赋给long形变量? 请问motoA6288+的汉字编码 100分马上给 今天去面试的一道题请高手指点 哪里可以下载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