Online-Compiler icon indicating copy to clipboard operation
Online-Compiler copied to clipboard

Java causing problem in input using scanner

Open musawershah1598 opened this issue 5 years ago • 2 comments

When ever i run the code with below command having scanner in code. java Hello < input.txt My input file have all the inputs specify for each scanner it giving me the following error. Exception in thread "main" java.util.NoSuchElementException: No line found at java.base/java.util.Scanner.nextLine(Scanner.java:1651) at Example.main(Example.java:7)

musawershah1598 avatar Aug 17 '19 04:08 musawershah1598

Rename your class as Main. Import all kinds of library that supports Scanner.

shawon100 avatar Aug 17 '19 06:08 shawon100

Thank you very much

On Sat, Aug 17, 2019, 11:27 AM Ashadullah Shawon [email protected] wrote:

Rename your class as Main. Import all kinds of library that supports Scanner.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shawon100/Online-Compiler/issues/7?email_source=notifications&email_token=AE3SXI6TBCYHYYWEECN4UNLQE6K4PA5CNFSM4IMOIOSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QETXA#issuecomment-522209756, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3SXI5EHGUWCTSDMSW6LITQE6K4PANCNFSM4IMOIOSA .

musawershah1598 avatar Aug 17 '19 07:08 musawershah1598