java - 请问在main方法中写成对象名.属性()并赋值,与直接参参数赋值输错误是什么原因?
大家讲道理
大家讲道理 2017-04-18 10:50:36
0
1
626

在类Telphone属性设置为public screen中,在main方法中写成对象名.属性()即hello2.screen=6.0f是对screen赋值,能输出结果;但是写成hello2.screen(6.0f)就不对,显示错误,请问这是什么原因,这两者有什么区别?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
大家讲道理

For variables, the equal sign is an assignment operation. The following writing method is to call a method called screen with a float parameter. Of course, if you don’t have this method, an error will be reported.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template