String class has a concat method that takes only String as parameter. So,only concat(String) will work. It does not work with any other parameter. Am i right?
Even if the programmer used (and s.append("def) were removed), the code would not work as intended. The String class is immutable, so any call to the concat method returns a new String object and does not modify the original String object. The programmer would need to do something like