I am trying to say if you enter a character it will do this; else if scanner input == null do this instead. I'm not getting any syntax errors, I just need to know how to word this so that if you don't enter any characters and hit ENTER then it will go to my default settings. Here is what I have so far.
Shape sq = new Square(10);
System.out.println("Choose character to fill your shape. A-Z, a-z, ! # $ % & ( ) * + Press ENTER.");
characterChoiceSquare = input.next();
if(characterChoiceSquare == input.next())
{
for(int m = 0; m < shapeChars.length; m++)
}
{
if(characterChoiceSquare.equals(shapeChars[m]));
{
char[] c1 = characterChoiceSquare.toCharArray();
char[] shapeCharacter = new char[sq.getSizeInt()];
for(int i = 0; i < sq.getSizeInt(); i++)
{
shapeCharacter[i] = c1[0]; // repeat the char input to fit shapeString
}
string = String.valueOf(shapeCharacter); //assign the value of the arraylist to shapeString
shapeString += string + "\n";
System.out.print(shapeString);
}
}
}
else if(characterChoiceSquare == null)
{
System.out.print(sq.displayCharacters());
}
Aucun commentaire:
Enregistrer un commentaire