Program Login di Java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package javaapplication29;
import javax.swing.JOptionPane;
/**
*
* @author ANGGA
*/

class login {
private int password =1234;
private String nama =”user”;

public void user(String usr,int pwd){
if(usr.equals(nama)&& pwd==password){
System.out.println(“Anda Berhasil Login”);
}
else
System.out.println(“Nama User Atau Password Salah”);
}
}

public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// JOptionPane input =new JOptionPane (System.in);

String user=JOptionPane.showInputDialog(“Masukkan Nama”,”Username”);
int password=Integer.parseInt(JOptionPane.showInputDialog(“Masukkan Password”,”****”));

login angga=new login();
angga.user(user, password);

// int angka=Integer.parseInt(input.showInputDialog(“Ini Angka”));
// System.out.println(angka);

}

}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s