0

I have this character creation program I'm working on. I'm using Eclipse and it says there are no problems, but it doesn't read a part of my code. What is going on and how do I fix it?

import java.util.Scanner;

public class Character
{
static Scanner scan = new Scanner(System.in);

public static void main(String[] args)
{

    String play = "yes";
    String play1;
    String play2;
    String play3;

    while (play.equals("yes"))
    {

    System.out.println("Let's create a character!");
    System.out.println("Select a type of headwear. (bald, hair, hat)");

    play1 = scan.next();

    System.out.println("Select a type of shirt. (no sleave, short sleave, long sleave)");

    play2 = scan.next();

    System.out.println("Select a type of pants. (short, medium, long)");

    play3 = scan.next(); \\does not read this part

    System.out.println("Your character:");

code followed by a HUGE nested if block.

SteveTwist
  • 13
  • 3
  • Since it cannot get three inputs it doesn't read the nested if block. – SteveTwist Nov 27 '16 at 01:00
  • Do you want to `scan.next()` over `scan.nextLine()`? – Andrew the Programmer Nov 27 '16 at 01:03
  • Not. The bug is **highly unlikely** to be in Eclipse. However, since we cannot see exactly what you are typing, it is hard to know if you are typing the wrong stuff, or if you using Scanner incorrectly for the way that you want the interface to work. (In either case, it will most likely be that input buffering is not working the way you expect it to work.) – Stephen C Nov 27 '16 at 01:42

0 Answers0