mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 21:43:15 +08:00
style: do not suppress try
(#5167)
This commit is contained in:
@ -68,7 +68,6 @@ final class ProductCipher {
|
||||
|
||||
System.out.println("Plaintext: ");
|
||||
System.out.println(plaintext);
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,6 @@ class BellmanFord /*
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ public final class ReverseStack {
|
||||
for (i = 0; i < n; i++) {
|
||||
stack.push(sc.nextInt());
|
||||
}
|
||||
sc.close();
|
||||
reverseStack(stack);
|
||||
System.out.println("The reversed stack is:");
|
||||
while (!stack.isEmpty()) {
|
||||
|
@ -30,12 +30,6 @@ public final class NonRepeatingElement {
|
||||
arr[i] = sc.nextInt();
|
||||
}
|
||||
|
||||
try {
|
||||
sc.close();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to close scanner" + e);
|
||||
}
|
||||
|
||||
// Find XOR of the 2 non repeating elements
|
||||
for (i = 0; i < n; i++) {
|
||||
res ^= arr[i];
|
||||
@ -55,7 +49,6 @@ public final class NonRepeatingElement {
|
||||
}
|
||||
|
||||
System.out.println("The two non repeating elements are " + num1 + " and " + num2);
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -47,7 +47,6 @@ public final class InsertDeleteInArray {
|
||||
for (i = 0; i < size2 - 1; i++) {
|
||||
System.out.println(b[i]);
|
||||
}
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,10 @@
|
||||
package com.thealgorithms.sorts;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class LinkListSort {
|
||||
|
||||
public static boolean isSorted(int[] p, int option) {
|
||||
try (Scanner sc = new Scanner(System.in)) {
|
||||
}
|
||||
int[] a = p;
|
||||
// Array is taken as input from test class
|
||||
int[] b = p;
|
||||
|
Reference in New Issue
Block a user