This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Search customer by ID  RSS feed

 
Greenhorn
Posts: 4
  • 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: 24295
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: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the code all I have.
 
Paul Clapham
Sheriff
Posts: 24295
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: 2476
317
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • 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: 2476
317
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • 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: 1325
3
Java Netbeans IDE Spring
  • 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.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!