0
case 7 :
            scan.nextLine();
            System.out.println("Ievadiet reisa sākuma staciju");
            k = scan.nextLine();
            System.out.println("Ievadiet reisa gala staciju");
            v = scan.nextLine();
                for(i=0; i<50; i++){

                for(j=0; j<5; j++){
            if(A[i][0].equals(k) && A[i][1].equals(v) && A[i][j]!=null)
                        System.out.println("Biļetes cena:"+A[i][4]);
                }
                if(A[i][j-1]!=null)
                    System.out.println();
            }
            break;

I can't find a solution for my problem. I need to print on screen the lines with asked text content. Everything works but in the end it shows this error. Can anybody help?

  • You have not provided enough information for us to help you with your specific problem. However, the linked Question and Answers explain how to diagnose and fix NullPointerException. – Stephen C May 07 '16 at 15:01
  • It is already known that in the Array A there are rows with null's after the filled rows. How can I avoid the error in this case? – Toms May 07 '16 at 15:10
  • By testing for `null` in the **appropriate** fashion. – Stephen C May 07 '16 at 23:02

0 Answers0