can anyone explain to me what exactly nextLine
method mean in java ?
how does it work ???
and #why java skipped nextLine()
if nextInt()
method invoked before it as the code below??!!
int i;
String s;
Scanner sc=new Scanner(System.in);
i=sc.nextInt(); //enter 5
s=sc.nextLine(); // enter helloWorld
System.out.println(i+" ** "+s);
that will print
5 **
i have tried alot of code ... and i have tried to write next()
method instead of nextLine()
method ...and its work ...the problem just in nextLine()
method