How to print without a comma?
<p>I am trying to invoke a method to print "R, a, b, b, i, t". My method should print nothing if the empty string ("") is passed.</p>

<pre><code>public static void printLetters(String a) {
    if (a == "")
        System.out.println(a);
    else
        for (int i = 0; i &lt;= a.length() - 1; i++) {
            char rabb = (a.charAt(i));
            System.out.print(rabb + ",");

            if (i != a.length() - 1) {
                System.out.print(" ");
            }
        }
}
</code></pre>

<p>Problem now is  I am printing "r,a,b,b,it", and I am not sure why. It seems like <code>if(i!=a.length()-1){</code> is not working to eliminate the last comma.</p>
