1

sorry for the language. I just can't understand why it wont enter the first while loop and goes straight to the end. The while starts with a boolean but it just wont proceed. I could use some help :) Thanks in advance. Now its at its (half) full. It doesn't have anything to do with equaling strings. Thanks again.

package guessTheNumber;

import java.util.Random;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        //Opening of the scanner.
        Scanner guess = new Scanner (System.in);

        //Entry - what the player will see before he starts.
        System.out.println("Hello.");
        System.out.println("Wellcome to the Guess the number game");
        String enter = guess.nextLine();
        System.out.println("I choose a nember and you have to guess what it is.");
        enter = guess.nextLine();
        System.out.println("Ready?");
        System.out.println("I don't care... Type NEW to start");

        String startGame = guess.nextLine(); 
        while (startGame == "NEW" || startGame == "New" || startGame == "new"){

            //generates new number
            Random newNumber = new Random();
            int newRandom = newNumber.nextInt();
            //here the player can guess the number
            System.out.println("I chose a number between 1-bitch. what number am I thinking of? ");


        //if the player chooses to end the game
        System.out.println("See you later mother ******.");

    }

}
Chen10b
  • 31
  • 5

0 Answers0