This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Search customer by ID

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know why my code is not working at all. In my Eclipse there's no errors shown at all.

I want to use the id to print the name of my customers, and that's my goal



 
Sheriff
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the code you posted doesn't print anything. Perhaps there's some other code which you didn't show us, and it's supposed to be printing something?

The only thing I can see which is not quite self-explanatory is the array of Customers called custArray. The method you posted ignores that array and searches something else which is called customers.
 
James Teter
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the code all I have.
 
Paul Clapham
Sheriff
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there you go then. There's nothing which calls that method so you shouldn't be surprised that it never gets run and never prints anything. (Not that it would print anything even if it did get run.)

Perhaps there's something else that you didn't tell us about? Some framework which somebody else is going to use to run your code, perhaps?
 
Saloon Keeper
Posts: 2650
333
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

James Teter wrote:I dont know why my code is not working at all. In my Eclipse there's no errors shown at all.


When I put you code in Eclipse, I see something like this (I changed the line numbers to agree with what you have posted):
 
Ron McLeod
Saloon Keeper
Posts: 2650
333
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

James Teter wrote:That's the code all I have.


Do you have that code inside a class?

Do you have a class named Customer?
 
Ranch Hand
Posts: 1332
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't replicated the code but I think that the method is not using custArray properly, please have a look at this code, it is using custArray;




On the other hand, you need to have a class called Customer with a member "ID". Then in order to call the method "searchCustomerByID" maybe the best is to write a run method as explained on this https://coderanch.com/wiki/660020/Main-Pain post.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!