Last active
August 29, 2015 14:20
-
-
Save agusmakmun/7ecaaf3b0caf799a1905 to your computer and use it in GitHub Desktop.
Ini adalah script cecker Admin, dengan menggunakan 2 constructor yang berbeda. Dan 1 method berupa apakahAdmin(), digunakan untuk check admin.
This file contains hidden or 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
/* | |
Ini adalah script cecker Admin, dengan menggunakan 2 constructor yang berbeda. | |
Dan 1 method berupa apakahAdmin(), digunakan untuk check admin. | |
Lihat soalnya : https://gist.github.com/agusmakmun/3255042298910fd3f2c5 | |
Lihat pemanggilannya : https://gist.github.com/agusmakmun/a22db6e9a879f03545f8 | |
@author Summon Agus | |
@blog bloggersmart.net | |
*/ | |
public class CekUser { | |
String idku = "Summon"; | |
String passwordku = "Agus"; | |
String id; | |
String password; | |
String nama; | |
String admin; | |
public CekUser (String id, String password) { | |
this.id = id; | |
this.password = password; | |
} | |
public CekUser (String id, String password, String nama, String admin) { | |
this.id = id; | |
this.password = password; | |
this.nama = nama; | |
this.admin = admin; | |
} | |
public boolean apakahAdmin() { | |
if (id.equals(idku) && password.equals(passwordku)) { | |
System.out.println("id = "+id+ "; password = "+password+"; ----> Benar, Selamat Datang Admin"); | |
return true; | |
} | |
else { | |
System.out.println("Salah, Anda Bukan Admin"); | |
return false; | |
} | |
} | |
} | |
// Result of Output | |
Salah, Anda Bukan Admin | |
id = Summon; password = Agus; ----> Benar, Selamat Datang Admin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment