Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Retriving data from vector by matching user id

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to create an employee class with employee id's,name and address,how can we store in vector, and how we can display his name and address from the vector when an employee id is given.
Below is my code which i have tried.



 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And ? What is your problem ?

I can spot one at line 13. You are not comparing Strings the way they should be compared. Use the equals() method instead.
 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi christophe,
My problem is i have a return null statement. I compare and return emp1. But i receive that null only. How should I change the method so as to return emp1?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stack trace should tell you exactly where the error happens. Can you post it here ?
 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AvoidRedHerrings. You were talking about a null statement, and all you have is "cannot find symbol".

EmployeeToCache is not found. Is it in its own file ? Is it compiled ? Is it in your classpath ?
 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe
It is really not intentional. The code I have posted worked fine. The problem was with return statement. After putting try catch it shown the errors I posted. I am a very beginner so I was not able to analyze that good as how you did. Thanks for your replies I l set the correct classpath as you have suggested.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does it compile without errors now ?
    Bookmark Topic Watch Topic
  • New Topic