Reputation: 1
I am currently working on a Knight's tour implementation in Java. I am trying to take the user input in the form (file)(rank) on my board.
File would be a char (a, b, c or d) and rank an int (1, 2 or 3).
I know how to get the input of these individually but how would I combine the input of the two, so that for example 'd2' is valid.
I am a beginner to java so any help would be much appreciated.
Upvotes: 0
Views: 94
Reputation: 431
you can use String format like this:
String input = String.format("%s"+"%d", file, rank);
where file
is your char
input and rank
is your int
input
Upvotes: 0