. so i have a question, i am quite new (2 weeks ) to
java, i have learned quite a bit about the language though. and am atempting to make a text based adventure., but theres a problem. i imported the scanner, made a scanner variable, used it to find out the persons name, then tried to say " so (name of the person) blah blah blah," but in the second part, it doesnt print the name of the person, it prints, i think the code for what a scanner is, or something like that. here is my code:
import java.util.Scanner;
public class therest {
public void start(){
Scanner name = new Scanner(System.in);
System.out.println("enter your name");
System.out.println("hello " + name.nextLine());
System.out.println("so " + name + "this is my first game" );
System.out.println("it is a text based adventure called ,the thief,");
System.out.println("it will be about using intoition to find as many er, um stealable,");
System.out.println(" objects as you can, and. well. stealng them");
System.out.println(" i hope you have fun, gooooood lucccccckkkkk!!! ");
}
}
and here is what the command line outputs:
enter your name
levi
hello levi(my name)
so java.util.Scanner[delimiters=\p{javaWhitespace}+][position=6][match valid=true][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\Q?\E][infinity string=\Q?\E]this is my first game
it is a text based adventure called ,the thief,
it will be about using intoition to find as many er, um stealable,
objects as you can, and. well. stealng them
i hope you have fun, gooooood lucccccckkkkk!!!