0

Is nextLine a keywords??

import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner myVar = new Scanner(System.in); System.out.println(myVar.nextLine()); } }

23rd May 2019, 3:13 AM
siri sa
siri sa - avatar
2 Respuestas
+ 9
nextLine() is a method defined in Scanner class. It's used to take String input. Similarly, there are separate methods for taking int, double, boolean inputs (nextInt(), nextDouble(), nextBoolean() etc.) See the official documentation for more details: https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
23rd May 2019, 4:25 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
23rd May 2019, 6:24 AM
siri sa
siri sa - avatar