String Concatenation (operator overloading)

4
String Concatenation (operator overloading) 3.0

description

String Concatenation (operator overloading). 3.0. overloading. String concatenation. 4 + 5 9 "wind" + "ow" "window" "Result: " + 6 "Result: 6" "# " + price + " cents" "# 500 cents". Quiz. System.out.println(5 + 6 + "hello"); System.out.println("hello" + 5 + 6);. 11hello. - PowerPoint PPT Presentation

Transcript of String Concatenation (operator overloading)

Page 1: String Concatenation (operator overloading)

String Concatenation(operator overloading)

3.0

Page 2: String Concatenation (operator overloading)
Page 3: String Concatenation (operator overloading)

Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

String concatenation

• 4 + 5═ 99

• "wind" + "ow"═ "window""window"

• "Result: " + 6═ "Result: 6""Result: 6"

• "# " + price + " cents"═ "# 500 cents""# 500 cents"

overloading

Page 4: String Concatenation (operator overloading)

Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Quiz

• System.out.println(5 + 6 + "hello");

• System.out.println("hello" + 5 + 6);

11hello11hello

hello56hello56