Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Java Util Scanner

Uploaded by

gaetan signe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Java Util Scanner

Uploaded by

gaetan signe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

java.util.

scanner

#java.util.sc
anner
Table of Contents
About 1

Chapter 1: Getting started with java.util.scanner 2

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;

//Code not shown

public int exampleMethod()


{
Scanner keyboardInput = new Scanner(System.in); //Scans character input.
int orcasPresent = myPackage.Scanner.scanForOrcas(); //<<Demonstration Here>>
return keyboardInput.nextInt() * orcasPresent;
}

(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

Getting started with


1 Community, Jerry Jeremiah, Mauve Ranger
java.util.scanner

https://riptutorial.com/ 4

You might also like