0% found this document useful (0 votes)
18 views

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
0% found this document useful (0 votes)
18 views

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
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