Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions