C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

How to use Scanner class in java?

+1 vote
4,239 views
asked by augustaina Sr Member (4,820 points)

1 Answer

0 votes
This class is introduce java 1.5 version and it can be used to Read the contents from a resource.

import java.io.*;

import java.util.*;

class Read{

public static void main(String[] args) throws IOException{

Scanner s = new Scanner(System.in);

System.out.println(“Enter your age:”);

String str = s.nextLine();

Int age = Integer.parseInt(str);

System.out.println(“Age:” + age);

            }

}
answered by rock Expert (14,990 points)

Related questions

0 votes
1 answer 24 views
24 views asked by sunny Expert (11,410 points)
0 votes
1 answer 51 views
51 views asked by augustaina Sr Member (4,820 points)
0 votes
1 answer 52 views
52 views asked by taye Sr Member (4,970 points)
0 votes
1 answer 34 views
34 views asked by sara Guru (24,570 points)
0 votes
1 answer 53 views
...