Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.util.Scanner; // I use scanner because it's command line.
  2.  
  3. public class Login {
  4. public void run() {
  5. Scanner scan = new Scanner (new File("the\\dir\\myFile.extension"));
  6. Scanner keyboard = new Scanner (System.in);
  7. String user = scan.nextLine();
  8. String pass = scan.nextLine(); // looks at selected file in scan
  9.  
  10. String inpUser = keyboard.nextLine();
  11. String inpPass = keyboard.nextLine(); // gets input from user
  12.  
  13. if (inpUser.equals(user) && inpPass.equals(pass)) {
  14. System.out.print("your login message");
  15. } else {
  16. System.out.print("your error message");
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement