+ 1
What's wrong with this code
I want to make it print each word reverse Example:sample input :I LOVE JAVA output :I EVOL AVAJ https://code.sololearn.com/c9DuMpa8XQiL/?ref=app
6 Respostas
+ 2
In line 8
String n=sc.next()+' ';
change to
String n=sc.nextLine();
//
Using next() will only return what comes before a space.
nextLine() will return whole line
+ 3
Good luck with learning then.
I provided you my example so next time you can also think this way to solve another problem.
// And of course I'm not saying that my example is better than yours. This is just other way to solve this problem.
+ 2
Oh yeah! 😀 thx # Michal
But what's different between. next () and nextLine() both can help in inputting string
+ 2
I added difference in my first post.
//And this is my example
https://code.sololearn.com/cEsGE4DkML7T/?ref=app
+ 2
Woop! It just went above my head, dude u belong to pro league whereas I use my basic knowledge about syntax in Java to form functioning codes as you can see I have tons of things left to learn In Java m just a beginner
+ 2
Yeah just ended in few lines unlike mine😁
Anyway thx