While using scanner code playground is throwing error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

While using scanner code playground is throwing error

import java.util.Scanner; public class Program { public static void main(String[] args) { System.out.println("Enter your username: "); Scanner BB = new Scanner(System.in); String Bike = BB.nextline(); System.out.println("Bike name is" + BB); } }

1st Oct 2017, 5:22 AM
Hrishi Bhoir
4 Answers
+ 2
nextLine() with a capital L
1st Oct 2017, 5:32 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
u must print bike and not bb i.e scanner itself..like system.out.println("bike name is" + bike);
1st Oct 2017, 5:25 AM
Suhail Pappu
Suhail Pappu - avatar
0
Still giving me same error stating cannot find symbol BB.nextline();
1st Oct 2017, 5:27 AM
Hrishi Bhoir
0
Also as in eclipse or intellj after printing the value the next line comes into picture, here we need to give the value at very start @ChaoticDawg it helped
1st Oct 2017, 5:42 AM
Hrishi Bhoir