Created
November 15, 2018 09:04
-
-
Save canokay/a4d5bb80c4f4b0bb32fa6f7d866be68e to your computer and use it in GitHub Desktop.
Java Console Login Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class JavaConsoleLogin { | |
public static void main(String[] args){ | |
Scanner input = new Scanner(System.in); | |
System.out.print("Kullanıcı Adı: "); | |
String username= input.nextLine(); | |
System.out.print("Şifre: "); | |
String password= input.nextLine(); | |
System.out.println("Kullanıcı adı: " + username); | |
System.out.println("Şifre: " + password); | |
if (username.equals(username)){ | |
if (password.equals("asd123")){ | |
System.out.println("Doğru giriş yaptı..."); | |
} | |
else{ | |
System.out.println("Şifre yanlış :("); | |
} | |
} | |
} | |
} |
input.close(); to end function main
https://github.com/MominVakas/Java-CommandLine-LoginSystem
try is project for java practice
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm new to java and whenever I type this
Scanner input = new Scanner(System.in);
I got this warning saying "Resource linked: input is never closed"... Though the code runs fine without any error, but Eclipse keeps indicating this warning and I don't like leaving warnings on my code especially when I don't know what they mean.