So, I'm trying to set up a simple config for a project. The goal here is to read certain values from a file and, if the file does not exist, to write said file. Currently, the creation of the file works fine, but my Scanner is acting a bit funny. When I reach the code

case "resolution": resolution = readConfig.next();

it makes the value of resolution "1024x768\nvsync" whereas it should only be "1024x768". If it were working as I planned, then the next value for

readingConfig = readConfig.next();

at the beginning of my while loop would be "vsync", which my switch statement would then catch and continue editing the values to those of the file.

Why is my Scanner picking up on the "\n" that is the 'enter' to the next line in the text document?

```
public static void main(String[] args) {
    int musicVol = 0;
    int soundVol = 0;
    String resolution = null;
    boolean vsync = false;
    Scanner readConfig;
    String readingConfig;
    File configFile = new File(gameDir + "\\config.txt");
    if (configFile.exists() != true) {
        try {
            configFile.createNewFile();
            PrintWriter writer = new PrintWriter(gameDir + "\\config.txt");
            writer.write("resolution = 1024x768 \n vsync = true \n music = 100 \n sound = 100");
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    try {
        readConfig = new Scanner(configFile);
        readConfig.useDelimiter(" = ");
        while (readConfig.hasNext()) {
            readingConfig = readConfig.next();
            switch (readingConfig) {
            case "resolution":
                resolution = readConfig.next();
                break;
            case "vsync":
                vsync = readConfig.nextBoolean();
                break;
            case "music":
                musicVol = readConfig.nextInt();
                break;
            case "sound":
                soundVol = readConfig.nextInt();
                break;
            }
        }
        readConfig.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}

```