Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started