0
Can someone Explain please.!?
while giving a challenge i got this question and it seems bit hard to me the code is: string x=""; string y"sololearn"; x+=y.substring(8,1); x+=y.substring(5,3); console.write(x); Ans : near (how?)
3 odpowiedzi
+ 6
i dont c#.
but
y.substring(8,1) = n
y.substring(5,3) = ear
+ 6
Syntax of substring is-
stringName.substring(index from, length of substring);
Jay has described the rest
0
step through the code, use break points, and output in between answers.
+= stands for x = x + ...
in the first line x is empty. The result of the substring is 'n'. That makes the x = 'n'
in the second line x = 'n' and the result of the substring is 'ear'. Which makes the finale result. 'n' + 'ear' = 'near'.