BaşlayınÜcretsiz Başlayın

Whole or decimal

Choosing the right data type is crucial in Java - it affects both accuracy and memory usage. Numbers with decimal points need different types than whole numbers. Let's practice making the right choice!

Bu egzersiz

Introduction to Java

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Choose the correct primitive type for dressPrice and shoePrice variables.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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;
    }
}
Kodu Düzenle ve Çalıştır