public static void searchCustomer(){
Scanner input=new Scanner(System.in);
L1:do{
clearConsole();
searchCustomerHomepage();
System.out.print("Enter Customer phone number : ");
String phone=input.next();
if(!isValidTpnumber(phone)){
System.out.println("\n\tInvalid input :");
}
int i=searchingArray(phone);
if(i!=-1){
System.out.println(orderIdArray[i]);
System.out.println(customerContactArray[i]);
System.out.println(tshirtSizeArray[i]);
System.out.println(amountArray[i]);
}
System.out.print("Do you want to search another customer report? (Y/N)");
char op=input.next().charAt(0);
if(op=='Y'||op=='y'){
continue L1;
}
}while(true);
}
//////SEARCHINGARRAY/////
public static int searchingArray(String phone){
for(int i=0;i<customerContactArray.length;i++){
if(customerContactArray[i].equals(phone)){
return i;
}
}
return -1;
}
In this code why null exception error occuring.I will put the error below.. Exception in thread "main" java.lang.NullPointerException at fashion.searchingArray(fashion.java:15) at fashion.searchCustomer(fashion.java:257) at fashion.main(fashion.java:127)
I want to solve above error & want to get knowledge about that mistake..I hope code is clear for you