LoslegenKostenlos loslegen

Strings, chars, and booleans

While the String data type is not a primitive, it is super important as well. It's time to practice them along with char and boolean.

Diese Übung ist Teil des Kurses

Introduction to Java

Kurs anzeigen

Anleitung zur Übung

  • Declare the tshirtSize variable using the correct primitive type.
  • Assign true to the isOnSale variable.
  • Declare String variable called color, setting its value to "green".

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

class NumericalDeclarations {
    public static void main(String[] args) {
    
    	// Declare the tshirt variable
    	____ tshirtSize = 'M';
        
        // Assign true to isOnSale
        boolean isOnSale = ____;
        
        // Declare and assign color
        ____ color = ____;
    }
}
Code bearbeiten und ausführen