package scanner; import java.util.Scanner; public class NextLine { public static void main(String[] args) { //nextLine()方法返回的是enter键之前的字符 Scanner line = new Scanner(System.in); //想用两次就直接掉用两次,把nextLine赋值给字符串 String lineStr = line.nextLine(); //hello String lines = line.nextLine(); //world System.out.println("lineStr: " + lineStr); //lineStr: hello System.out.println("lines: " + lines); //lines: world } }