package javaapplication1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class arrrrr {
public static void main(String[] args) throws IOException {
String n,m;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
ArrayList l1=new ArrayList();
l1.add("india");
l1.add("chennai");
l1.add("tamilnadu");
l1.add("mumbai");
n=br.readLine();
for(int j=0;j<4;j++)
{
if(n==l1.get(j))
{
System.out.println("The array location :"+"l1["+j+"]");
}
}
}
}
I want to find a array location. When given input, the program exits automatically. If I assign the value to n, it works perfect. I want to know why the programs exits after giving input.