I'm noticing that people are using the BufferedReader for the TEST problem, but is this the only way to do it? I would like to know what specifically is wrong with my code, and why it isn't passing the validator, being marked as the wrong answer. Any responses would be appreciated.

[bbone=Java,155]import java.util.Scanner;

class main
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int newInput = 0;

	do
	{
		newInput = input.nextInt();
		System.out.println(newInput);
	}
	while ( newInput != 42 );
}

}[/bbone]

  • created

    Mar '11
  • last reply

    Mar '11
  • 1

    reply

  • 942

    views

  • 2

    users

You code does not return the correct solution for the sample input. See my submissions to your code in the post above.

Suggested Topics

Want to read more? Browse other topics in JAVA based languages or view latest topics.