有个疑问,本期视频教学中的 var变量,假设我想在main。java中不只是赋值,进行有scream等变量的运算,却显示错误,求解? Telephone phone=new Telephone(); phone.sendMessage(); phone.scream=5.0f; phone.cpu=2.0f; phone.mem=1.0f; phone.sendMessage(); phone.var=scream+mem;
phone.scream+phone.mem吧。是phone的属性