ComenzarEmpieza gratis

String concatenation

Joining Strings is useful in many situations, for example, when personalizing a pre-prepared message.

Este ejercicio forma parte del curso

Introduction to Java

Ver curso

Instrucciones del ejercicio

  • Use String concatenation to add itemName to the first printout statement.
  • Add itemPrice to the second printout statement.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

class ConcatenateAway {
    public static void main(String[] args) {
    
        String itemName = "VR Headset";
        int itemPrice = 599;
        
        // Add itemName to the printout statement
        System.out.println("Item is " + ____);
        
        // Add itemPrice to the printout statement
        System.out.println("Price is " ____ ____);
    }
}
Editar y ejecutar código