A simple Java program to check whether a given number is prime. It includes error handling for invalid inputs and uses an optimized algorithm for prime detection. The package follows best practices, and the program ensures efficient resource management.
- Checks if a number is prime.
- Handles invalid inputs gracefully.
- Uses an optimized algorithm for efficiency.
- Java 8 or later
- Clone the repository:
git clone https://github.com/nurulashraf/java-prime-checker.git
- Navigate to the project directory:
cd java-prime-checker
- Compile the program:
javac src/primechecker/PrimeChecker.java
- Run the program:
java -cp src primechecker.PrimeChecker
java-prime-checker/
│── src/
│ └── PrimeChecker.java
│── README.md
└── LICENSE
This project is licensed under the MIT License. See the LICENSE file for details.