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
.
Este ejercicio forma parte del curso
Introduction to Java
Instrucciones del ejercicio
- Declare the
tshirtSize
variable using the correct primitive type. - Assign
true
to theisOnSale
variable. - Declare
String
variable calledcolor
, setting its value to"green"
.
Ejercicio interactivo práctico
Prueba este ejercicio completando 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 = ____;
}
}