+ 1

Hello again ! I've made a program which is supposed to read the Input and add " Welcome," to it, but it ain't workin :/

import java.util.Scanner; class MyClass { public static void main(String[] args) { Scanner myVar = new Scanner(System.in); System.out.printIn( " Welcome, " + MyVar.nextLine()); } } Thanks for any help :3

14th Jun 2019, 1:40 PM
KAMPFTEDDY McFlausch
KAMPFTEDDY McFlausch - avatar
10 Answers
+ 4
I have found the error: Not myVar.nextLine() is out of printstream but printIn. In your code you are using i (I) but it is a small L (l). In capital letters: PRINTLN
14th Jun 2019, 2:28 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
I can not really explain why it is not working. It has to do with the println() method/print stream. String str = myVar.nextLine(); System.out.println("Welcome " + str);
14th Jun 2019, 2:05 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Yes.
14th Jun 2019, 2:13 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Forget my post. I don't know why but when I tried your code I got an error message. But I tried an own code it works: https://code.sololearn.com/c7jlJ9e7pFM1/?ref=app
14th Jun 2019, 2:24 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
That's why none of my codes work !
14th Jun 2019, 2:46 PM
KAMPFTEDDY McFlausch
KAMPFTEDDY McFlausch - avatar
+ 2
Thx lol
14th Jun 2019, 2:47 PM
KAMPFTEDDY McFlausch
KAMPFTEDDY McFlausch - avatar
+ 2
second you declare myVar but call uppercase MyVar.
14th Jun 2019, 5:18 PM
zemiak
+ 1
Oh so if I get it right you have to save the " MyVar.nextLine " as a String to be able to use it ?
14th Jun 2019, 2:07 PM
KAMPFTEDDY McFlausch
KAMPFTEDDY McFlausch - avatar
+ 1
Oooooh
14th Jun 2019, 2:46 PM
KAMPFTEDDY McFlausch
KAMPFTEDDY McFlausch - avatar
+ 1
Oh ye, didn't even notice that. Thanks !
14th Jun 2019, 5:19 PM
KAMPFTEDDY McFlausch
KAMPFTEDDY McFlausch - avatar