= operator in java

java, operators, string

Solution

In this case there is no overloading. The java piece that differs from C++ is the definition of "" - The java compiler converts anything in "" into a java.lang.string and so is a simple assignment in your example. In C++ the compiler converts "" into a char const * and so needs to have a conversion from char const* to std::string.

Problem

can somebody explain me why it's possible to do: ``` String s = "foo"; ``` how is this possible without operator overloading (in that case the "=") I'm from a C++ background so that explains...

Original source