I've been going crazy trying to research the answer to this and am getting nowhere!!!
I'm testing out codenvy to improve on an online sandbox for my computer science high school students. I wrote a test program to get familiar with codenvy and ran into some user input issues.
My code:
import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
System.out.println("Hello World!");
System.out.println("Hello Worldie!");
Scanner input = new Scanner(System.in);
//input.nextLine();
System.out.println("Enter a #");
int number = input.nextInt();
System.out.println("is this your card...." + number);
//input.close();
}
}
My errors/output:
command: cd /projects/test javac -classpath /projects/test: -sourcepath src: -d /projects/test/bin src/Main.java java -classpath /projects/test:/projects/test/bin Main
Hello World!
Hello Worldie!
Enter a #
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:14)
Can someone help me with what I'm missing? I'm wondering if it's some codenvy feature that I have to adjust?
Thanks, core