will this code works fine? or will it gives error?

Object obj=5;
int i=6;
i=i+obj;

Answer Posted / prakash kesharwani

this definitely work.
since obj as type integer. and also i as integer.
so the output will be 11.

its gives error when obj is type string.

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is entity framework slow?

524


Why to use Html.Partial in ASP.Net MVC?

603


What operating systems will the .net framework 3.0 be available for?

568


How to use multiple submit buttons in asp.net mvc?

583


How do I use partial view?

531






What is the use of the default route {resource}.axd/{*pathinfo} ?

553


What is Layout in ASP.Net MVC?

577


What is routeconfig.cs in mvc 4?

645


What is display mode in mvc?

582


explain how you can load related entities in ef (entity framework)?

544


What is difference between html.beginform and ajax.beginform?

606


Can you Write the GC(Garbage Collector) Algoritham in .NET? (But not Explination of Working of GC).

1801


What are the differences between Partial View and Display Template and Edit Templates in ASP.Net MVC?

594


What is the use of view model in asp.net mvc?

683


What is the use of the default route?

603