What is the result of x+y*z and why?



What is the result of x+y*z and why?..

Answer / Deepa Sinha

The result depends on the data types of x, y, and z. If they are integers or floats, the operation will be performed according to the usual rules of arithmetic: first multiplication (y*z), then addition (x+(y*z)). However, if x is a string, the result will be a concatenation of x, y*z as strings. This is because the '+' operator has different meanings for numeric and string types.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Scala Interview Questions

Explain if-else-if terminology?

1 Answers  


mention the types of variables in scala? And what is the difference between them?

1 Answers  


Explain different types of identifiers in scala?

1 Answers  


What is Option in Scala? What are Some and None? What is Option/Some/None Design Pattern in Scala?

1 Answers  


What is akka in scala? Explain

1 Answers  


Explain exception handling in scala?

1 Answers  


What is the difference between var and value?

1 Answers  


How to define Factory methods using object keyword in Scala? What is the use of defining Factory methods in object?

1 Answers  


What is a applicative?

1 Answers  


What do you mean by trait in scala and when it is used?

1 Answers  


What is anonymous (lambda) function in scala?

1 Answers  


What is map in scala?

1 Answers  


Categories