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

Scanner Example

This Java code uses a Scanner to take user input, stores it as an integer, and prints the input integer back out.

Uploaded by

Ganesh
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
0% found this document useful (0 votes)
18 views1 page

Scanner Example

This Java code uses a Scanner to take user input, stores it as an integer, and prints the input integer back out.

Uploaded by

Ganesh
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 1

// Scanner example

import java.util.Scanner;

class ScannerExample

public static void main( String args[ ] )

Scanner sc = new Scanner( System.in );

int n;

System.out.print( "Enter a Number : ");

n = sc.nextInt();

System.out.println( "The given number : " + n );

Output:

Enter a Number : 100

The given number : 100

You might also like