Класът Scanner се намира в пакета util и осигурява прости средства за четене и преобразуване до примитивни типове данни информация от файл включително и от стандартния вход(System.in) .
Класът анализира и разделя входната информация на единици (tokens), като използва разграничител, който може да се променя но подразбиране е празен интервал.
Някои методи на класа:
тип на резултата Описание  Scannernew Scanner(System.in) //конструкторBigDecimalnextBigDecimal()
Scans the next token of the input as aBigDecimal.BigIntegernextBigInteger()
Scans the next token of the input as aBigInteger.BigIntegernextBigInteger(int radix)
Scans the next token of the input as aBigInteger.booleannextBoolean()
Scans the next token of the input into a boolean value and returns that value.bytenextByte()
Scans the next token of the input as a byte.bytenextByte(int radix)
Scans the next token of the input as a byte.doublenextDouble()
Scans the next token of the input as a double.floatnextFloat()
Scans the next token of the input as a float.intnextInt()
Scans the next token of the input as an int.intnextInt(int radix)
Scans the next token of the input as an int.StringnextLine()
Advances this scanner past the current line and returns the input that was skipped.longnextLong()
Scans the next token of the input as a long.longnextLong(int radix)
Scans the next token of the input as a long.shortnextShort()
Scans the next token of the input as a short.shortnextShort(int radix)
Scans the next token of the input as a short.
Пример:
import java.util.*; 
public class StdInputTest
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
// get first input
System.out.print("What is your name? ");
String name = in.nextLine();
// get second input
System.out.print("How old are you? ");
int age = in.nextInt();
// display output on console
System.out.println("Hello, " + name + ". Next year, you'll be " + (age + 1));
}
}
Четене от конзолата - клас JOptionPane
използва изкачащ диалогов прозорец
import javax.swing.JOptionPane; 
public class TestInp {
public static void main( String[] args ){
String name = "",s_age="";
int age;
name=JOptionPane.showInputDialog("Please enter your name");
s_age=JOptionPane.showInputDialog("How old are You?");
age=Integer.parseInt(s_age);
String msg = "Hello " + name + " next year,you'll be " + (age + 1);
JOptionPane.showMessageDialog(null, msg);
}
}
JOptionPane.showInputDialog() - връща низ като резултат