0
public void method(int a[], int len, int x)
{
    Map<Integer, Integer> map = new HashMap<Integer, Integer>();

    for(int i=0;i<len;i++)
    {
        System.out.println(i);
        int temp = x-a[i];
        System.out.println(temp);
        if(temp>=0 && map.get(temp) ==1)
        {
            System.out.println(temp+" "+a[i]);
        }
        else
        {
            map.put(a[i],1);
        }
    }
}

java.lang.NullPointerException is occurring on line no. 9. How to remove this???

user3654181
  • 441
  • 2
  • 4
  • 13

0 Answers0