I came across one question like this
a="hello", b="bye", c=a*b
then what will the anwser of print c?
That depends on the implementation of the *
operator on string data types. And that usually depends on the programming language you use. In most statically typed languages I know, this operator is not defined on strings.
In JavaScript, the value of c will be NaN.
It's a trick question, I think. You can't multiply a string with another string. I don't think any language allows this.
精彩评论