• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No Element Found Exception

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!!
 
Ranch Hand
Posts: 954
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dint understand your question, can you please explain again?
 
Marshal
Posts: 79263
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79263
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic