getline in java
// Java program to illustrate the
// nextLine() method of Scanner class in Java
// without parameter
import java.util.*;
public class GFG1 {
public static void main(String[] argv)
throws Exception
{
String s = "Gfg \n Geeks \n GeeksForGeeks";
// create a new scanner
// with the specified String Object
Scanner scanner = new Scanner(s);
// print the next line
System.out.println(scanner.nextLine());
// print the next line again
System.out.println(scanner.nextLine());
// print the next line again
System.out.println(scanner.nextLine());
scanner.close();
}
}