i've created one program like twitter. here is part of my program.
public static void main(String[] args) {
while (true) {Scanner a = new Scanner(System.in);
System.out.println("1.Login\t2.Sign Up\t0.Close");
int choice = 0;
choice = a.nextInt();
User user = new User();
Tweets tweets = new Tweets(uSname);
Account accounts = new Account();
switch (choice) {
case 1:
Scanner b = new Scanner(System.in);
System.out.println("Enter UserName:");
uSname = b.nextLine();
Scanner c = new Scanner(System.in);
System.out.println("Enter Your Password:");
Cpassword = c.nextLine();
accounts.login(uSname, Cpassword);
Tweets t = new Tweets(uSname);
accounts.follow();
//t.display();
break;
case 2:
try {
signup();
} catch (Exception e) {
System.out.println(e);
}
}
break;
}
}
if case 1 is executed Scanner getting input in a fracture of seconds it will terminated unexpectedly without showing any error, it didn't call login function! How do solve this, i am beginner.