Using Special Characters in Java (using primitive char)

119 views Asked by At

I'm basically trying to build a random password generator in Java. I'm trying to build it using a char array, basically:

char[] password = new char[8]

I want to be able to include "special" characters in this array (such as @, $, *, etc). Can these characters be placed in a char array, and if so, how?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

Put characters in array inline

char[] password = {'@', '$', '*'};