Code:
int letter1 = 65 + (int) (Math.random() * (90 - 65));
int letter2 = 65 + (int) (Math.random() * (90 - 65));
int letter3 = 65 + (int) (Math.random() * (90 - 65));
int number1 = (int) (Math.random() * 10);
int number2 = (int) (Math.random() * 10);
int number3 = (int) (Math.random() * 10);
int number4 = (int) (Math.random() * 10);
System.out.println("" + (char)letter1 + (char)letter2 + (char)letter3 + "-"
+ number1 + number2 + number3 + number4);
This is the lines of code to generate random license plate, and I have a question on why I need to add "" at the beginning of the System.out.println argument. When I don't put quotation marks at the beginning of the arugments, the letter variables don't change to char type and end up returning integer values whereas when they are there, the variables change into char type and return random alphabets.
I don't quite get why I need the quotation marks to return the char type.