"While browsing the code base of a recently inherited project," Joey L writes, "I found this curious method."

    private String insertComma(String src){

           StringBuffer result = new StringBuffer();
           try {
                           char d = '"';
            } catch (RuntimeException e) {
            return result.toString();

"In addition to the strange indentation, I noticed three issues with this code."

"1. What is the try/catch for?
2. Why is the delimiter not a class variable or a parameter?
— and finally —
3. What the $§%& does the method name to do with the content?

Joey continued, "while the world does not have an answer to every stupid question, I can at least provide an answer to the last question. Here's the 'syntax' to use the method from above."

    String result = ... + insertComma(varA) + "," + insertComma(varB) + ...;

"Hopefully that clears some things up."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!