Skip to content

Commit 0cf0aba

Browse files
authored
Update TopKWords.java
1 parent 68d9450 commit 0cf0aba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Others/TopKWords.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public Map<String, Integer> getDictionary() {
2020

2121
fis = new FileInputStream(fileName); // open the file
2222
int in = 0;
23-
String s = new String(); // init a empty word
23+
String s = ""; // init a empty word
2424
in = fis.read(); // read one character
2525

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

0 commit comments

Comments
 (0)