I'm new to programming, so I was wondering if someone could help me. What I'm trying to is make the user input a number, and if the number is in the file, it'll spit something back out, and if it's not in the file, it'll keep asking for a number. I don't know exactly how to do this, but if someone could point me in the right direction, that would be great. Thanks in advance!
Collection
, or as a big String
, the exact type depends on how you actually trying to achieve this). Scanner
, BufferedReader
or File.readAllLines()
Bonus:
Try to do each of the bullets in a different method and only combine them in your main()
- it will help you to learn about basic methods design as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.