Java - Programming Language
This course covers the basics of programming in Java. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!
I'm starting a coding bootcamp
Want to learn web development in a fun and gamefied environment? Head over to and see what I'm working on!

Building A Guessing Game

Lesson 20
Author : Mike Dane
Last Updated : October, 2017


Copy// import java.util.Scanner;
Scanner keyboardInput = new Scanner(;

String secretWord = "giraffe";
String guess = "";
int guessCount = 0;
int guessLimit = 3;
boolean outOfGuesses = false;

while(!guess.equals(secretWord) && !outOfGuesses){
     if(guessCount < guessLimit){
          System.out.print("Enter a guess: ");
          guess = keyboardInput.nextLine();
     } else {
          outOfGuesses = true;

     System.out.println("You Lose!");
} else {
     System.out.println("You Win!");