You are not logged in. Please login at www.codechef.com to post your questions!

×

HP18 lucky number - showing error has NoSuchElementFound

Hi My code works perfectly in IDE and here it is showing NoSuchElementFound error. How could this be?

asked 06 Jan, 20:39

deepak4babu's gravatar image

2★deepak4babu
1
accept rate: 0%


I'm also getting the same error :(

link

answered 09 Jan, 23:36

ramanpreet_26's gravatar image

2★ramanpreet_26
1
accept rate: 0%

NoSuchElementException generally occurs in Java when Scanner is used in a wrong way.

The most common mistake is when Scanner is re-initialized in a function after every function call.

One possible solution is to create a global Scanner or creating it in Main and passing it as argument to the functions.

link

answered 09 Jan, 23:46

xariniov9's gravatar image

6★xariniov9
1.1k18
accept rate: 10%

tried this also but not working

link

answered 10 Jan, 00:00

ramanpreet_26's gravatar image

2★ramanpreet_26
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×169

question asked: 06 Jan, 20:39

question was seen: 351 times

last updated: 10 Jan, 00:00