c# - Execution of Console.writeline in below code -
namespace variabledefinition { class programme { static void main(string[] args) { short a; int b ; double c; /* actual initialization */ = 10; b = 20; c = + b; console.writeline("a = {0}, b = {1}, c = {2}", a, b, c); console.readline(); } } }
kindly explain me meaning of a={0} b={1} , c={2} in console.writeline statement. 0,1,2 stand for
they placeholders variables. 3 placeholders in string correspond 3 variable arguments appear after string.
the variable in first placeholder populated first argument (a
in case). sec placeholder sec argument (b
) , 3rd third argument (c
).
the code posted should print next console:
a = 10, b = 20, c = 30
c#
No comments:
Post a Comment