找错。报错显示cpu cannot be resolved to a variable、price cannot be resolved to a variable、
package imooc; //类名 public class Phone { public static void main(String[] args){ Phone helloPhone=new Phone(); double screen=89; float cpu; float price; helloPhone.goodPhone(); helloPhone.xingNeng(); } public void goodPhone(){ System.out.println(price); System.out.println("好手机价格也好!"); } public float xingNeng(){ // float cpu=89.0f; System.out.println(cpu); return cpu; } }
不是说成员变量的作用域是整个类的内部吗?