I\'m trying to print this loop without the last comma. I\'ve been Googling about this and from what i\'ve seen everything seems overcomplex for such a small problem. Surely
Found another simple way using regex:
String str = "abc, xyz, 123, "; str = str.replaceAll(", $", ""); System.out.println(str); // "abc, xyz, 123"