0

I have keyset in which keys are product name, I want to accumulate all the product name in single String variable in below format:

Prod1-Prod2-Prod3

I have tried

for(String prod: map.keySet()){
String prodName+=prod+"-";
}

but it displays

nullProd1-Prod2-

How do I get rid of null and the last extra hyphen

user9634982
  • 565
  • 5
  • 24

0 Answers0