User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:util:scanner:nextline

nextLine()

public String nextLine()

return the scanned content from the input

example nextLine() in java

package scanner;
 
import java.util.Scanner;
 
public class Scanner {
 
    public static void main(String[] args) {
 
        /* Create Scanner Object for the input from the keyboard */
        Scanner scan = new Scanner(System.in); 
 
        String line;
 
        System.out.print("Please enter what you want: ");
        line = scan.nextLine(); // read keyboard buffer
 
        System.out.println("You typed in: " + nextLine);
 
        scan.close(); // close the object 
    }
}

output of nextLine()

  Please enter what you want: The Anwer is 42
  You typed in: The Anwer is 42
advertising
java/util/scanner/nextline.txt · Last modified: 2013/04/10 10:14 by 94.223.12.247

Impressum Datenschutz