String concatenation
Joining String
s is useful in many situations, for example, when personalizing a pre-prepared message.
Diese Übung ist Teil des Kurses
Introduction to Java
Anleitung zur Übung
- Use String concatenation to add
itemName
to the first printout statement. - Add
itemPrice
to the second printout statement.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
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 " ____ ____);
}
}