public static void main(String [] args) {
String firstName = "";
double age =0;
String surname ="";
String password ="";
Scanner scan = new Scanner (System.in);
System.out.println("Please enter your first name:");
firstName= scan.nextLine();
System.out.println("Please enter your age:");
age=scan.nextDouble();
System.out.println("Please enter your surname:");
surname= scan.nextLine();
System.out.println("Please enter your password:");
password=scan.nextLine();
}
我是否为surnameBackwards创建另一个变量?
答案 0 :(得分:0)
这样的事情:
String surnameBackwards = StringUtils.reverse(surname) + "*" + age + "*" + StringUtils.reverse(firstName)