We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68d9450 commit 0cf0abaCopy full SHA for 0cf0aba
Others/TopKWords.java
@@ -20,7 +20,7 @@ public Map<String, Integer> getDictionary() {
20
21
fis = new FileInputStream(fileName); // open the file
22
int in = 0;
23
- String s = new String(); // init a empty word
+ String s = ""; // init a empty word
24
in = fis.read(); // read one character
25
26
while (-1 != in) {
@@ -74,7 +74,7 @@ public static void main(String[] args) {
74
while (k > list.size()) {
75
System.out.println("Retype a number, your number is too large");
76
input = new Scanner(System.in);
77
- k = new Integer(input.nextLine());
+ k = input.nextInt();
78
}
79
for (int i = 0; i < k; i++) {
80
System.out.println(list.get(list.size() - i - 1));
0 commit comments