CreateAccount类
import java.util.Scanner;
public class CreateAccount{
public static void main(){
CreateAccount obj1 = new CreateAccount();
obj1.accountNumberPin();
}
public void accountNumberPin(){
System.out.println("create a six digit account number: ");
Scanner input = new Scanner(System.in);
int accNum = input.nextInt();
System.out.println("create four digit pin: ");
Scanner input2 = new Scanner(System.in);
int accPin = input2.nextInt();
}
public int getAccNum(){
return accNum;
}
public int getAccPin(){
return accPin;
}
}
登录类
import java.util.Scanner;
public class Login{
public void login(){
CreateAccount test= new CreateAccount();
int theaccNum = test.getAccNum();
int theaccPin = test.getAccPin();
System.out.println("Enter account number: ");
Scanner input1 = new Scanner(System.in);
int accNumberInput= input1.nextInt();
System.out.println("Enter account pin: ");
Scanner input2= new Scanner(System.in);
int accPinInput = input2.nextInt();
if(accNumberInput==theaccNum && accPinInput == theaccPin){
System.out.print("1 2 1 2 this is just a test");
}
}
}
PS,我知道get方法目前存在问题