Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Java language input Scanner tutorial

Posted on September 27, 2017January 24, 2020

Table of Contents

  • Java language input Scanner tutorial
      • Java input Scanner class
      • How to get input from user in Java
      • Scanner Delimiters with Scanner class

Java language input Scanner tutorial

In this tutorial, we will discuss the concept of Java language input Scanner tutorial

Java input Scanner class

The java.util.Scanner class is used to read input of primitive type of data, like int, double, float etc .. from the user in java.

How to get input from user in Java

Follow the steps given below:-
  • import java.util.Scanner class
  • Create the object of scanner class
  • use in-built methods to get input
In-built methods and description for getting input in Scanner class of Java

 

Java language input Scanner tutorial
Input methods
We will learn to use the simple example of the java Scanner class. We can read the int, string and double as an  input using scanner class

Program 1
Java language input Scanner tutorial
Example
When we executed the above program, it produced the following results
Enter the number….
100
You entered 100
Program 2
Java language input Scanner tutorial
Example
When we executed the above program, it produced the following results
Java language input Scanner tutorial
Output
program 3

 

Java language input Scanner tutorial
Example
When we executed the above program, it produced the following results
Java language input Scanner tutorial
Output
 

Scanner Delimiters with Scanner class

 
Program 1
We will learn the example of Scanner class with delimiter
Java language input Scanner tutorial
Example
When we executed the above program, it produced the following results
Java language input Scanner tutorial
Output
Suggested for you
Data types and variable in java language
Variable types ofJava language
class and main method in Java language

 

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes