First of all, remember to indent your code for readability.

Concept 1.

for (int i=0;i<=9;i++){

area[i]=s.next();// Use this for String Input

pincode[i]=s.nextInt();

s.nextLine();//Use this for going to next line of input

}

Concept 2.

if(search.compareTo(area[j])==0){ 

// compare Strings using compareTo method (which returns 0 if equal

Rest of your code and concepts are correct 🙂

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *