MulaiMulai sekarang secara gratis

Assigning numbers

Working with numbers is fundamental in programming - from counting items to calculating prices. Let's practice declaring and assigning numeric variables with real values!

Latihan ini adalah bagian dari kursus

Introduction to Java

Lihat Kursus

Petunjuk latihan

  • Assign itemCount the value of 3425.
  • Declare the totalPrice variable using the correct primitive type and assign the value of 11999.99.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

class NumericalDeclarations {
    public static void main(String[] args) {
    
        // Declare and assign variables
        int itemCount = ____;
        ____ totalPrice ____ ____;
    }
}
Edit dan Jalankan Kode