Get startedGet started for free

Assigning numbers

Assigning variables is a crucial skill for your workflow. Time to practice it some more!

This exercise is part of the course

Introduction to Java

View Course

Exercise instructions

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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