Aan de slagGa gratis aan de slag

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!

Deze oefening maakt deel uit van de cursus

Introduction to Java

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

class NumericalDeclarations {
    public static void main(String[] args) {
    
        // Declare and assign variables
        int itemCount = ____;
        ____ totalPrice ____ ____;
    }
}
Code bewerken en uitvoeren