ComenzarEmpieza gratis

Strings, chars, and booleans

Beyond numbers, Java offers data types for text, individual characters, and true/false values. Each serves a unique purpose in representing different kinds of information. Let's practice working with these essential types!

Este ejercicio forma parte del curso

Introduction to Java

Ver curso

Instrucciones del ejercicio

  • 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".

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

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 = ____;
    }
}
Editar y ejecutar código