For a project in school (intro to java), we have to make a program using arrays. I decided to make a login program that stores logins. It works perfectly, except when deleting items. This is my code
    public void delete() throws FileNotFoundException{
    int p;
    c.clear();
    c.print("Please enter a website to delete it's login info: ");
    String delete_name = c.readLine();
    Boolean found = false;
    // Search for the search key, and display the matching elements
    c.println("Searching for " + delete_name + "...");
    for (int i = 0; i < pass.length; i++)
        if (pass[i][0].equals(delete_name)) {
            c.println("Deleting login for " + pass[i][0]);
            String new_array[][] = new String[pass.length - 1][3];
            //remove an element
            for (int w = 0; i < new_array.length; i++)
                for (int j = 0; j <= 2; j++) {
                    p = w;
                    if (i >= p) {
                        new_array[w][j] = pass[w + 1][j];
                    } else {
                        new_array[w][j] = pass[w][j];
                    }
                }
            found = true;
            pass = new_array;
        }
    if (found == false) {
        c.println("No luck! " + delete_name + " wasn't found, please try again.");
        delete();
    }
        fileWriter();
}
When it writes to the file, anything after the part that should have been deleted gets changed to "null".
Sorry if the format is awful, I'm just starting with java :) Any help is greatly appreciated, thanks!
 
    