有一個程式問題想請教一下
class BMW_Serial
{
private int carLength, enCC, maxSpeed;
public String modelName;
public void ShowData()
{
carLength=423;
engCC=3000;
maxSpeed=250;
System.out.println(modelName+ "基本資料");
System.out.println("車身長度:" +carLength);
System.out.println("氣缸CC數:" +engCC);
System.out.println("最高車速:" +maxSpeed);
}
}
public class Ch1_02 extends BMW_Serial
{
public Ch1_02(String name)
{
modelName=name;
}
public static void main(String args[])
{
Ch1_02 BMW318=new Ch1_02("BMW 318i");
BMW318.ShowData();
}
}
問題主要是engCC=3000; 以及System.out.println("氣缸CC數:" +engCC);這兩個語句不知道出了什麼問題, 以下是執行結果:
Ch1_02.java:8: cannot find Symbol
Symbol:variable engCC
Location class BMW_Serial
engCC=3000;
^
Ch1_02.java:12:Cannot find Symol
Symol:variable engCC
Location:class BMW_Serial
System.out.println("氣缸CC數:" +engCC);
^
有沒有人知道這是什麼意思呢????
[ 本帖最後由 花之慶次 於 2009-9-28 02:09 編輯 ]