خرید بک لینک

Vote count: 0

public static void main(String[] args) {
    Scaer sc = new Scaer(System.in);
    System.out.println("Enter file name:");
    String name = sc.nextLine();
    creatingfeatures(name, "part1");
}

public static void creatingfeatures(String filename, String type) {
    String outputFile = "../data/" + type + "/" + type + ".csv";
    System.out.println("This is the output file: " + outputFile);
    try {
        CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, true), ',');
.
.
.
.
        }
        csvOutput.close();
    }
    catch (IOException e) {
        System.out.println("Please enter another file name (wrong name given)");
        System.exit(0);
    }
}

Hello all, when I use an invalid file name (Ie when the file is not found), the message under the catch was not printed. Anybody knows why?

asked 4 mins ago

1 Answer

Vote count: 0

You have an extra { before the csvOutput.close():

   }
// ↑ here!
   csvOutput.close();

answered 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 15 ارديبهشت 1395 ساعت: 15:45

صفحه بندی