I have a NullPointerException Within the Tournament Class and the Test Class. I call the method of the Tournament to define in the Test class, then i assign it in the Tournament class to create Team objects. it gives me a NullPointerException on Tournament tour = new Tournament(); and File file = new(fileLocation);.
i think its because i declared the wrong file path, but the file is in the project folder.To make it easier i set the directory of the file in the Test class to exactly know where the problem is and also change file if i needed. Please comment if you need any more blocks of the classes.
Test Class:
 Tournament tour = new Tournament();
 tour.setFile("Tourney2Teams.csv"); 
Tournament :
Scanner input;
    public String fileLocation;
    public void setFile(String x)
    {
        this.fileLocation=x;
    }
    File file = new File(fileLocation);
and this is the method to read the file:
public void readingFile()
    {
        try{
            input = new Scanner(file).useDelimiter(",");
        }
        catch (FileNotFoundException e)
        {
            System.out.print("File Not Found\n");
        }
    }
 
     
     
     
    