Search Engine With Java


Search Engine With Java

import javax.swing.*;
class SearchEngine
{
public static void main(String[] args)
{
String [][] array = new String [3][4];
int sum=0;
array [0][0] = “Ihsan”;
array [0][1] = “Gagah”;
array [0][2] = “Ganteng”;
array [0][3] = “Makan”;
array [1][0] = “Makan”;
array [1][1] = “Tadi”;
array [1][2] = “Pagi”;
array [1][3] = “Gagah”;
array [2][0] = “Ihsan”;
array [2][1] = “Makan”;
array [2][2] = “Buah”;
array [2][3] = “Kecil”;

String input = JOptionPane.showInputDialog(null,”Masukkan kata!”);

for (int i=0;i<=2 ;i++ )
{
for (int j=0;j<=3 ;j++ )
{
if (input.equalsIgnoreCase(array[i][j])==true)
{
sum++;

}
}
}

JOptionPane.showMessageDialog(null,input+” : “+sum);

}
}

One thought on “Search Engine With Java

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