Ask 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 will be thrown. 123 + 456

+4
Answers (1)
  1. 9 January, 02:23
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers