日期:2014-05-20  浏览次数:20605 次

办我找一个错误?谢谢
import java.util.Scanner;
class Test2 
{
public static void main(String[] args) 
{
Scanner s=new Scanner(System.in);
phone nokiaN900=new phone();
phone anycall=new phone();
phone htc=new phone();
nokiaN900.brand="nokia";
nokiaN900.price=2001;
nokiaN900.color="黑色";
nokiaN900.xitong="塞班";
nokiaN900.pixel="500万";
nokiaN900.paiZhao();
nokiaN900.showInfo();
boolean f=nokiaN900.isOnline();
if(f)
{
System.out.println("手机能上网");
}else
{
  System.out.println("手机不能上网");
}
System.out.println("请输入价格变化:");
boolean c=s.nextBoolean();
System.out.printin("请输入价格变化多少");
int r=s.nextInt();
double p=nokiaN900.changePrice(c,r);
System.out.println("今天的价格是:"+p);
String a=nokiaN900.getPixel(200);
System.out.println(a);
}
}



------解决方案--------------------
Java code
import java.util.Scanner;

class Test2 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        phone nokiaN900 = new phone();
        phone anycall = new phone();
        phone htc = new phone();
        nokiaN900.brand = "nokia";
        nokiaN900.price = 2001;
        nokiaN900.color = "黑色";
        nokiaN900.xitong = "塞班";
        nokiaN900.pixel = "500万";
        nokiaN900.paiZhao();
        nokiaN900.showInfo();
        boolean f = nokiaN900.isOnline();
        if (f) {
            System.out.println("手机能上网");
        } else {
            System.out.println("手机不能上网");
        }
        System.out.println("请输入价格变化:");
        boolean c = s.nextBoolean();
        System.out.printin("请输入价格变化多少");            //    l和i是长的很像但是这不是你打错的借口!有木有!!
                                                        //    printin改成println 完毕
        int r = s.nextInt();
        double p = nokiaN900.changePrice(c, r);
        System.out.println("今天的价格是:" + p);
        String a = nokiaN900.getPixel(200);
        System.out.println(a);
    }
}