Password Script With Java


Password Script With Java

import javax.swing.*;
class Password
{
public static void main(String[] args)
{
String [][] array = new String [3][4];
boolean benar = false;
int indeksi=0;
array [0][0] = “Hans”;
array [0][1] = “hoho”;
array [0][2] = “123″;
array [0][3] = “123″;
array [1][0] = “Bram”;
array [1][1] = “haha”;
array [1][2] = “456″;
array [1][3] = “456″;
array [2][0] = “Udin”;
array [2][1] = “hehe”;
array [2][2] = “531″;
array [2][3] = “531″;

String nama = JOptionPane.showInputDialog(null,”Masukkan nama!”);
String pass = JOptionPane.showInputDialog(null,”Masukkan password!”);

for (int i=0;i<=2 ;i++ )
{
for (int j=0;j<=1 ;j++ )
{
if ((nama.equalsIgnoreCase(array[i][j])==true) && (pass.equalsIgnoreCase(array[i][j+1])==true))
{
benar=true;
indeksi=i;

}
}
}

if (benar==true)
{
JOptionPane.showMessageDialog(null,”Nama :”+array[indeksi][0]+”\nPass :”+array[indeksi][1]+”\nAdd :”+array[indeksi][2]+”\nHP :”+array[indeksi][3]);
}
else {
JOptionPane.showMessageDialog(null,”Nama atau Password SALAH”);
}

}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s