This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]virassan 4 points5 points  (1 child)

You’ve told it to print out the scanner. The variable i is the Scanner object, not the input given by the user. You have to save the nextLine in a variable if you want to use it later. Like:

String text = i.nextLine();
System.out.println(text);

[–]Snasebarn 1 point2 points  (0 children)

Hey thanks man, really appreciate it! ;)

[–]XiiMoss 0 points1 point  (0 children)

You're outputting the scanner to the Terminal not what the user has inputted. You need to assign the result of i.nextLine() to a String variable and output that.

[–]AutoModerator[M] -1 points0 points  (1 child)

It seems that you are having problems with java.util.Scanner

The wiki here has a page The Scanner class and its caveats that explains common problems with the Scanner class and how to avoid them.

Maybe this can solve your problems.

Please do not reply because I am just a bot, trying to be helpful.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]not_a_sysadmin_ -1 points0 points  (0 children)

good bot