Hi there. I'm getting two errors on this code and it won't run.
Is there anything I'm doing wrong?
I've highlighted them with arrows.
import javax.swing.JOptionPane; import javax.swing.JTextArea; public class StorageApp { private StorageAppEntry entry[]; private int counter; private String SName; private int notfound = 0; public static void main(String[] args) { StorageApp a = new StorageApp(); ----------> a.entry = new StorageAppEntry[]; int option = 0; try { while (option != 5) { String content = "Choose an Option\n\n" + "[1] Add an Entry\n" + "[2] Delete an Entry\n" + "[3] Update an Entry\n" + "[4] View all Entries\n" + "[5] View Specific Entry\n" + "[6] Exit"; option = Integer.parseInt(JOptionPane.showInputDialog(content)); switch (option) { case 1: a.addEntry(); break; case 2: a.deleteEntry(); break; case 3: a.editEntry(); break; case 4: a.viewAll(); break; case 5: a.searchEntry(); break; case 6: System.exit(1); break; default: JOptionPane.showMessageDialog(null, "Invalid Choice!"); } } }catch(NumberFormatException e){ JOptionPane.showMessageDialog(null, "Please Choose a Number in the displayed Menu"); } } public void addEntry() { entry[counter] = new StorageAppEntry[100]; entry[counter].setName(JOptionPane.showInputDialog("Enter name: ")); entry[counter].setUsername(JOptionPane.showInputDialog("Enter username: ")); entry[counter].setPassword(JOptionPane.showInputDialog("Enter password: ")); entry[counter].setdescription(JOptionPane.showInputDialog("Enter description: ")); counter++; } public void viewAll() { String addText = " NAME\tUSERNAME\tPASSWORD\tDESCRIPTION\n\n"; int nonNull = 0; for (int i = 0; i < entry.length; i++) { if (entry[i] != null) { addText = addText + entry[i].getInfo() + "\n"; nonNull++; } else if (nonNull == counter) { break; } } JOptionPane.showMessageDialog(null, new JTextArea(addText)); } public void searchEntry() { SName = JOptionPane.showInputDialog("Enter Name to find: "); searchMethod(); } public void searchMethod() { for (int i = 0; i < counter; i++) { if (entry[i].getName().equals(SName)) { JOptionPane.showMessageDialog(null, entry[i].getInfo2()); notfound = 0; break; } else { notfound++; } } if (notfound != 0) { JOptionPane.showMessageDialog(null, "Name Not Found!"); } } public void editEntry() { SName = JOptionPane.showInputDialog("Enter Name to edit: "); for (int i = 0; i < counter; i++) { if (entry[i].getName().equals(SName)) { -----------> entry[i] = new StorageAppEntry[]; entry[i].setName(JOptionPane.showInputDialog("Enter new name: ")); entry[i].setUsername(JOptionPane.showInputDialog("Enter new username: ")); entry[i].setDescription(JOptionPane.showInputDialog("Enter new description: ")); notfound = 0; break; } else { notfound++; } } if (notfound != 0) { JOptionPane.showMessageDialog(null, "Name Not Found!"); } } public void deleteEntry() { SName = JOptionPane.showInputDialog("Enter Name to delete: "); for (int i = 0; i < counter; i++) { if (entry[i].getName().equals(SName)) { JOptionPane.showMessageDialog(null, "Found!"); entry[i] = null; break; } } } }