Lilith26 wrote:Why not?
The problem is that I don't want a method
as this is kind of quiz.So?
I code a password and replace it with "*". Each time you guess a letter star changes into a letter. problem is that if I do a method it would reset my stringbuffer every turn to a number of *s. This is why I wanted to initiazlize it in a constructor and than write a method to replace stars with letters
StringBuffer has a c'tor that takes a String, so all you have to do is write a tiny little method that takes in a character and a count and builds up a String from them.
StringBuffer sb = new StringBuffer(myMethod('*', count));