PdfPrep.com

What will be the output of the above code?

You work as a Software Developer for ManSoft Inc. You create an application using Visual Studio .NET 2005.

You write the following code snippet in the application:

int amt = 50;

String s = "John gave me " + amt + " dollars";

Console.WriteLine(s);

What will be the output of the above code?
A . "John gave me amt dollars"
B . "John gave me 50 dollars"
C . Integer variable cannot concatenate with the string
D . Invalid type cast exception

Answer: B

Exit mobile version