Skip to content

Commit 2023730

Browse files
authored
Prevent instantiation of SnellLaw class
Make SnellLaw class non-instantiable by adding a private constructor.
1 parent c772277 commit 2023730

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/thealgorithms/physics/SnellsLaw.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
* n1 * sin(theta1) = n2 * sin(theta2)
66
* @see <a href="https://en.wikipedia.org/wiki/Snell%27s_law">Snell's Law</a>
77
*/
8-
public class SnellLaw {
9-
8+
public final class SnellLaw {
9+
private SnellLaw() {
10+
throw new AssertionError("No instances.");
11+
}
1012
/**
1113
* Computes the refracted angle (theta2) in radians.
1214
*

0 commit comments

Comments
 (0)