Question: Java language Hi. I am confusing about how to prevent duplicated customer ID entry in Java by using array. This is part of my code

 Java language Hi. I am confusing about how to prevent duplicated

customer ID entry in Java by using array. This is part of

Java language Hi. I am confusing about how to prevent duplicated customer ID entry in Java by using array. This is part of my code : public Customer cust; public int i = 0; public Customer custList[] = new CustomerInfo (10); = private void addRecBTNAction Performed java.awt.event.ActionEvent evt) { // TODO add your handling code here: String custID = custIDTF:getText(); String custName = custNameTF.getText(); String custAge = custAge TrigetText(); if(custList[il.getCustId() == custIDX JOptionPane.showMessageDialog(null, "Customer ID already exists"); else if(sustList[i].getCustId() != custIDX info = new Customerlnfo(custID, custName, custAge); custList[i] = info; i++; JOptionPane:show MessageDialog(null,"Customer information added successfully!"); } } The yellow highlight is error part. The system show java.lang.NullPointerException when I run it. Please help me to prevent duplicated customer ID entry

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!