Skip to content

Commit 926ed2e

Browse files
authored
Merge pull request TheAlgorithms#1217 from Hassan-Elseoudy/master
Closing scanners.
2 parents 98ff29d + a1f59c3 commit 926ed2e

27 files changed

+29
-4
lines changed

Conversions/AnyBaseToAnyBase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public static void main(String[] args) {
5252
}
5353
}
5454
System.out.println(base2base(n, b1, b2));
55+
in.close();
5556
}
5657

5758
/**

Conversions/AnytoAny.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static void main(String[] args) {
2424
dec /= db;
2525
}
2626
System.out.println(dn);
27+
scn.close();
2728
}
2829

2930
}

Conversions/DecimalToBinary.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static void bitwiseConversion() {
5353
n >>= 1;
5454
}
5555
System.out.println("\tBinary number: " + b);
56+
input.close();
5657
}
5758

5859
}

Conversions/HexToOct.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public static void main(String args[]) {
6464
// convert decimal to octal
6565
octalnum = decimal2octal(decnum);
6666
System.out.println("Number in octal: " + octalnum);
67-
68-
67+
scan.close();
6968
}
7069
}

Conversions/HexaDecimalToDecimal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static void main(String args[]) {
3434
and it returns the decimal form in the variable dec_output.
3535
*/
3636
System.out.println("Number in Decimal: " + dec_output);
37-
37+
scan.close();
3838

3939
}
4040
}

Conversions/OctalToHexadecimal.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public static void main(String args[]) {
5959
// Pass the decimla number to function and get converted Hex form of the number
6060
String hex = DecimalToHex(decimal);
6161
System.out.println("The Hexadecimal equivalant is: " + hex);
62+
input.close();
6263
}
6364
}
6465

DataStructures/Graphs/BellmanFord.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public void go()//Interactive run for understanding the class first time. Assume
100100
System.out.println();
101101
}
102102
}
103+
sc.close();
103104
}
104105
/**
105106
* @param source Starting vertex

DataStructures/HashMap/Hashing/Main.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static void main(String[] args) {
4242
return;
4343
}
4444
}
45+
In.close();
4546
}
4647
}
4748
}

DataStructures/Trees/RedBlackBST.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ public void insertDemo() {
309309
printTreepre(root);
310310
break;
311311
}
312+
scan.close();
312313
}
313314

314315
public void deleteDemo() {

DynamicProgramming/EditDistance.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ public static void main(String[] args) {
7474
//ans stores the final Edit Distance between the two strings
7575
int ans = minDistance(s1, s2);
7676
System.out.println("The minimum Edit Distance between \"" + s1 + "\" and \"" + s2 + "\" is " + ans);
77+
input.close();
7778
}
7879
}

0 commit comments

Comments
 (0)