Java Util Scanner
Java Util Scanner
scanner
#java.util.sc
anner
Table of Contents
About 1
Remarks 2
Examples 2
Installation or Setup 2
Credits 4
About
You can share this PDF with anyone you feel could benefit from it, downloaded the latest version
from: java-util-scanner
It is an unofficial and free java.util.scanner ebook created for educational purposes. All the content
is extracted from Stack Overflow Documentation, which is written by many hardworking individuals
at Stack Overflow. It is neither affiliated with Stack Overflow nor official java.util.scanner.
The content is released under Creative Commons BY-SA, and the list of contributors to each
chapter are provided in the credits section at the end of this book. Images may be copyright of
their respective owners unless otherwise specified. All trademarks and registered trademarks are
the property of their respective company owners.
Use the content presented in this book at your own risk; it is not guaranteed to be correct nor
accurate, please send your feedback and corrections to info@zzzprojects.com
https://riptutorial.com/ 1
Chapter 1: Getting started with
java.util.scanner
Remarks
This section provides an overview of what java.util.scanner is, and why a developer might want to
use it.
It should also mention any large subjects within java.util.scanner, and link out to the related topics.
Since the Documentation for java.util.scanner is new, you may need to create initial versions of
those related topics.
Examples
Installation or Setup
The java.util.Scanner class is a simple text scanner which can parse primitive types and strings
using regular expressions. A Scanner breaks its input into tokens using a delimiter, which by
default matches whitespace.
java.util.Scanner is part of the Java API, and is therefore included by default with each Java
installation.
To use Scanner in your code, you first need to specify where it is in Java's library: Scanner is in
the package java.util.
The easy way is to add this line at the top of your file:
import java.util.Scanner;
When the code compiles, "Scanner" will refer to that class. If you want to use another class also
named Scanner, you can specify each usage individually, although this is can get cumbersome:
import java.util.Scanner;
(In this case, scanForOrcas() is a static method of your custom class, myPackage.Scanner.
myPackage.Scanner must be in the folder myPackage and contain the line package myPackage;)
https://riptutorial.com/ 2
Read Getting started with java.util.scanner online: https://riptutorial.com/java-util-
scanner/topic/7950/getting-started-with-java-util-scanner
https://riptutorial.com/ 3
Credits
S.
Chapters Contributors
No
https://riptutorial.com/ 4