0

Why we add zero on console.write("hello{0}")

18th Dec 2017, 2:07 PM
aysar
2 Answers
0
You need the braces and the number, when you have an optional argument to substitute this {0} with an Integer, character, Double, etc. Else it is not required. The number indicates the argument to substitute into, and the numbering starts from 0. Eg : Integer age = 17; String name = "Guy1"; Console.Write("{0} is {1} years old.", name, age);
18th Dec 2017, 2:15 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar