A fun little project in Java where the computer picks a random number between 1 and 100 and you have to guess it. Simple, interactive, and a perfect beginner-friendly game!
- π― Computer randomly generates a number between 1β100
- β¨οΈ Accepts user guesses and gives hints (Too high / Too low)
- π Unlimited attempts until you guess correctly
- π Congratulates you with total attempts taken
- πͺ Exit gracefully with
Ctrl+D(Linux/macOS) orCtrl+Z(Windows)
javac Number_Guessing_Game.javaWelcome to the Number Guessing Game!
I'm thinking of a number between 1 and 100. Try to guess it!
Press Ctrl+D (Unix/macOS) or Ctrl+Z (Windows) then Enter to exit.
Enter your guess: 50
Too low! Try again.
Enter your guess: 75
Too high! Try again.
Enter your guess: 63
π Congratulations! You guessed the number in 3 tries.
Thanks for playing!
-
Language: Java 11+
-
Type: CLI (Command-Line Interface)
-
Libraries: None (only Scanner & Random)
Want to improve this little game? Fork the repo and submit a PR:
git checkout -b feature/new-idea
git commit -m "Add difficulty levels"
git push origin feature/new-ideaThis project is open-source and free to use...
π‘ βEvery wrong guess brings you closer to the right one!β