Hello everyone!
I've just started a programming class at Uni, and we're dealing with Java.
Consequently I got TextMate to work with, as I've heard many good things about it - but I stumbled upon a problem.
One of the practice assignments we were supposed to do was related to the Scanner. I have the following code:
I have cross-referenced this with my course mates, and the code seems to work for them. They're all running various versions of Windows. However, I get the following error:
I have no idea what this means, or what I can do about it. I checked my Java version in the Terminal, it's:
Very grateful for any replies regarding this!
Edit: I am running a MacBook Pro, OS X 10.5.7 if that helps.
I've just started a programming class at Uni, and we're dealing with Java.
Consequently I got TextMate to work with, as I've heard many good things about it - but I stumbled upon a problem.
One of the practice assignments we were supposed to do was related to the Scanner. I have the following code:
Code:
import java.util.Scanner;
class testtwo
{
public static void main(String[] args)
{
Scanner askname = new Scanner(System.in);
System.out.println("What's your name?");
String answer = askname.nextLine();
System.out.println("Hello " + answer + "!");
}
}
I have cross-referenced this with my course mates, and the code seems to work for them. They're all running various versions of Windows. However, I get the following error:
Annoying error said:Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1471) at testtwo.main(testtwo.java:13)
I have no idea what this means, or what I can do about it. I checked my Java version in the Terminal, it's:
Terminal said:java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)
Very grateful for any replies regarding this!
Edit: I am running a MacBook Pro, OS X 10.5.7 if that helps.