how to remove brackets character in string (java)

The first argument of replaceAll takes a regular expression.

All the brackets have meaning in regex: Brackets are used in regex to reference capturing groups, square brackets are used for character class & braces are used for matched character occurrence. Therefore they all need to be escaped...However here the characters can simply be enclosed in a character class with just escaping required for square brackets

test = test.replaceAll("[\\[\\](){}]","");

To remove all punctuation marks that include all brackets, braces and sq. brackets ... as per the question is:

String test = "watching tv (at home)"; 
test = test.replaceAll("\\p{P}","");