Ask Question
23 July, 20:40

Given two Generic variables, A with value "123" and B with value 456, what would the Write Line output of A + B be? 123456 579 An exception will be thrown. 123 + 456

+5
Answers (1)
  1. 23 July, 21:34
    0
    123456

    Explanation:

    When an integer value is added to a string value the resulting value is a string. + operator is used for both numeric additions and string addition also knows as string concatenation. In addition when one operand of the equation is a string the program interprets all values as string. As system is interpreting all values as a string it will apply a string addition method instead of mathematical addition. So here A is a string and B is an integer value. when we add A and B system will treat B aslo as a string, upon addition the result will be String concatenating both A and B to a single string. Hence the result of A+B will be

    A+B = 123456

    As WriteLine method takes string as Input it will just write the resulting string to file
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Given two Generic variables, A with value "123" and B with value 456, what would the Write Line output of A + B be? 123456 579 An exception ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers