count characters, words and lines in file
问题 This should count number of lines, words and characters into file. But it doesn't work. From output it shows only 0 . Code: public static void main(String[] args) throws IOException { int ch; boolean prev = true; //counters int charsCount = 0; int wordsCount = 0; int linesCount = 0; Scanner in = null; File selectedFile = null; JFileChooser chooser = new JFileChooser(); // choose file if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { selectedFile = chooser.getSelectedFile();