Skip to content

Commit

Permalink
Update TopKWords.java
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkookoo authored Apr 9, 2018
1 parent 68d9450 commit 0cf0aba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Others/TopKWords.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Map<String, Integer> getDictionary() {

fis = new FileInputStream(fileName); // open the file
int in = 0;
String s = new String(); // init a empty word
String s = ""; // init a empty word
in = fis.read(); // read one character

while (-1 != in) {
Expand Down Expand Up @@ -74,7 +74,7 @@ public static void main(String[] args) {
while (k > list.size()) {
System.out.println("Retype a number, your number is too large");
input = new Scanner(System.in);
k = new Integer(input.nextLine());
k = input.nextInt();
}
for (int i = 0; i < k; i++) {
System.out.println(list.get(list.size() - i - 1));
Expand Down

0 comments on commit 0cf0aba

Please sign in to comment.