BufferedReader input data by keyboard

Source: Internet
Author: User

  1. Input data by keyboard using InputStreamReader and BufferedReader
  2. Class Ex6_5_1
  3. {
  4. public static void Main (string[] args)
  5. {
  6. //1. Using InputStreamReader as the data type
  7. //Create InputStreamReader new Object ISR with keyboard system.in for input device
  8. InputStreamReader isr=New InputStreamReader (system.in);
  9. //2. Using BufferedReader as the data type, create a new object with the new object ISR BufferedReader
  10. BufferedReader br=New BufferedReader (ISR);
  11. System.out.print ("input data:");
  12. //3. Collecting data read into by the keyboard
  13. String Line=br.readline ();
  14. //4. outputting data just entered from the keyboard
  15. System.out.print ("you entered from the keyboard:" +line);
  16. }
  17. }

BufferedReader input data by keyboard

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.