这是我的代码:
public void viewFlight() {
int select;
String option;
String newOrigin = null;
viewFlightOrigin();
}
public void viewFlightOrigin() {
option = console.nextLine();
switch (select) {
case 1:
System.out.println("=======================================");
System.out.println("city of origin: Melbourne");
System.out.println("=======================================");
newOrigin = "Melbourne";
break;
// ...
}
}
如何在不声明字段中的变量或在字段中重新声明的情况下viewFlight()
再次使用中的局部变量?viewFlightOrigin()
viewFlightOrigin()