You can use:
String str1 = str.replaceAll("[.]", "");
instead of:
String str1 = str.replaceAll(".", "");
As @nachokk said, you may want to read something about regex, since replaceAll
first parameter expects for a regex expression.
Edit:
Or just this:
String str1 = s.replaceAll("[,.]", "");
to make it all in one sentence.