The Artima Developer Community
Sponsored Link

Java Buzz Forum
How to read user input from Console in Java using Scanner Example

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 470
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
How to read user input from Console in Java using Scanner Example Posted: Dec 8, 2012 10:13 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: How to read user input from Console in Java using Scanner Example
Feed Title: Java67
Feed URL: http://java67.blogspot.com/feeds/posts/default?alt=rss
Feed Description: Java and technology tutorials, tips, questions for all programmers.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67

Advertisement
Apart from reading file, Scanner can also read user input from Console in Java. Just like in case of reading file, we have provided File as source for scanning, We need to provide System.in as source to scan for user input in Console. Once you created and initialized java.util.Scanner, you can use its various read method to read input from user. If you want to read String, you can use nextLine(), if you want to read integer numbers, you can use nextInt(). Subsequently you can use nextFloat() to read float input, nextDouble() to read double input etc. Scanner class also allows you to define your own pattern and scan for that.
Read more ยป

Read: How to read user input from Console in Java using Scanner Example

Topic: Who is stealing your memory? The Application Servers Edition Previous Topic   Next Topic Topic: Maven, Continuous Integration and Rotating Knives


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us