Java bugs, again | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java bugs, again

AGAIN, MORE BUGS So my program is giving some strange error for the simplest thing I’ve ever designed: java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\x{2c}][decimal separator=\x{2e}][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\QNaN\E][infinity string=\Q∞\E] https://code.sololearn.com/cG778c3j7n1P/?ref=app

24th Dec 2020, 4:36 AM
Dallas Griffith
Dallas Griffith - avatar
7 Answers
+ 5
For taking input you need to write like this - Scanner input = new Scanner(System.in) ; int n = sc.nextInt() ; String line = sc.nextLine() ; String word = sc.next() ; So on....... Then System.out.println(word + line) ; the error comes because you are trying to print the object. Edit: It is actually not an error but it is printing the object's value
24th Dec 2020, 4:44 AM
Krish
Krish - avatar
+ 5
Martin Taylor ok thanks but it is only visible in the web version.
24th Dec 2020, 11:05 AM
Krish
Krish - avatar
+ 3
24th Dec 2020, 4:51 AM
Krish
Krish - avatar
+ 3
Martin Taylor Well ive practiced a little bit, ive just reset EVERY course i did tho, thats why you see 0, cuz i reset them all today, i realized i need to just go through them all again, even PHP, which ive went through 3 times now 😂😂😂
24th Dec 2020, 5:06 AM
Dallas Griffith
Dallas Griffith - avatar
+ 3
Martin Taylor bro how did you know how much xp he has in java?
24th Dec 2020, 6:30 AM
Krish
Krish - avatar
+ 2
Martin Taylor Thats exactly why im going thru it again 😂😂😂 I have a problem learning programming languages easy, thats why i have to do this course like 3 times before i actually get decent. lol
24th Dec 2020, 5:20 AM
Dallas Griffith
Dallas Griffith - avatar
+ 1
Thank you Krish 😂😂😂 Im sooo bad lol, but i used to be worse 😳😂 (Some would think thats impossile, but belive me, i used to be. here is fhe proof: https://code.sololearn.com/wSNDn34hyUf1/?ref=app )
24th Dec 2020, 4:47 AM
Dallas Griffith
Dallas Griffith - avatar