|
-
September 17th, 2010, 09:33 AM
#1
Java input
Hi i have a problem with the following code:
<code>
import java.util.Scanner;
public class Woorden{
public static void main (String[] argv){
Scanner input = new Scanner(System.in);
String zin;
System.out.print("Zin ");
if (input.hasNextLine()){
while (input.hasNext()){
System.out.println(input.next());
}
}
}
}
</code>
The program should promt the user for one input line and then print the elements of that line one at a time. However, the program does not stop. The input is entered by using keyboard + command line.
Can anyone help me with this problem?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|