指定數值
在程式設計中處理數字是基本功——從計數到計算價格都會用到。來練習用實際數值宣告並指定數值變數吧!
本練習屬於課程
Java 入門
練習說明
- 將
itemCount指定為3425。 - 以正確的基本型別宣告變數
totalPrice,並指定數值11999.99。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
class NumericalDeclarations {
public static void main(String[] args) {
// Declare and assign variables
int itemCount = ____;
____ totalPrice ____ ____;
}
}