0% found this document useful (0 votes)
2 views1 page

Java Scanner Class Input Methods

Uploaded by

rinki.m.chaube
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java Scanner Class Input Methods

Uploaded by

rinki.m.chaube
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Scanner a built-in class in Java that is used to take input from the user like numbers, words, or

entire lines — using the keyboard (or even from files).

It is part of the [Link] package. Scanner a built-in class in Java that is used to take input from the
user like numbers, words, or entire lines — using the keyboard (or even from files).

It is part of the [Link] package.

Import Scanner Class from java util Pacakage

import [Link];

Create object of Scanner Class

Scanner sc = new Scanner([Link]);

User Methods to take input

After creating the object, use dot (.) operator to call these methods:

nexttint() → for integer input

nextLine() → for full line of text

next() → for a single word

nextDouble() → for decimal numbers

You might also like