lundi 2 novembre 2020

Clearing and array and filling it with 0's [closed]

How do I clear an array, by filling it in with all zero using an if statement?

I tried this

static void ClearMySize(){

        if(MySize != null){
            Arrays.fill(MySize, 0);
            PrintMySize();
        }
        System.out.println("\nArray has been cleared: " + Arrays.toString(MySize));
        PrintMySize();
        Menu();
    
    }

But that doesn't work. It just seems to crash my code.

Aucun commentaire:

Enregistrer un commentaire