Error:Java Scanner nextLine not working after next[Solution]

Publié le: 11 janvier 2021
sur la chaîne: BS Sandhu
3,990
59

In Scanner class if we call nextLine() method after any one of the seven nextXXX() method then the nextLine() doesn’t not read values from console and cursor will not come into console it will skip that step.
The nextXXX() methods are nextInt(), nextFloat(), nextByte(), nextShort(), nextDouble(), nextLong(), next().

This problem occurs only for Scanner class, due to nextXXX() methods ignore newline character and nextLine() only reads till first newline character. If we use one more call of nextLine() method between nextXXX() and nextLine(), then this problem will not occur because nextLine() will consume the newline character

#Java #Scanner #Error
I hope you enjoyed java tutorial!

Previous Video :   • How to Take input from User in Java using ...  
--- Thank you for your love and support ---
Thanks NCS for wonderful work:
Track: Besomorph - Afterlife (ft.EMM) [NCS Release]
Music provided by NoCopyrightSounds.
Watch:    • Besomorph x EMM - Afterlife | Electronic |...  
Free Download / Stream: http://ncs.io/Afterlife


Sur cette page du site, vous pouvez voir la vidéo en ligne Error:Java Scanner nextLine not working after next[Solution] durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur BS Sandhu 11 janvier 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,990 fois et il a aimé 59 téléspectateurs. Bon visionnage!