Get startedGet started for free

Whole or decimal

You've seen several different primitive types for numerical values.

Can you choose the correct one?

This exercise is part of the course

Introduction to Java

View Course

Exercise instructions

  • Choose the correct primitive type for the dressPrice variable.
  • Choose the correct primitive type for the shoePrice variable.

Hands-on interactive exercise

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

class WholeOrDecimal {
    public static void main(String[] args) {
    
        byte dressSize = 8;
        float shoeSize = 11.5F;
        
        // Choose the correct primitive type
        ____ dressPrice = 55;
        ____ shoePrice = 49.9;
    }
}
Edit and Run Code