• Post Reply Bookmark Topic Watch Topic
  • New Topic

No Element Found Exception  RSS feed

 
Vinay Tripathi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Had below element in my occupy.txt which tells number of people in each room
1 3 4 1 0 3 4 2 1 5
and below code is for checking how Many people are in each room

It Works Perfectly fine For Room number 0 to 9 But When I enter Room number Above This instead of
throwing element not found exception it always says Like Room 12 Has 1 Guests any Advice
Thanks In ADVANCE !!!
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dint understand your question, can you please explain again?
 
Campbell Ritchie
Marshal
Posts: 56540
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I added code tags to your post. Always use the tags; it would have looked a lot better if you had indented the code correctly.
Never never close a Scanner pointing to System.in.
You have not explained how your file works. What do the numbers mean? Maybe you should have a room class which records the room number and how many people have booked.

Look very closely at your for loop heading.
 
Campbell Ritchie
Marshal
Posts: 56540
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vinay Tripathi wrote:. . . It Works Perfectly fine For Room number 0 to 9 . . .
Not when I tried it, it didn't. It told me 1 guest for everything.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!