CommencerCommencer gratuitement

Whole or decimal

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

Can you choose the correct one?

Cet exercice fait partie du cours

Introduction to Java

Afficher le cours

Instructions

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

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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;
    }
}
Modifier et exécuter le code