This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!

Campbell Ritchie

Marshal
+ Follow
since Oct 13, 2005
Cows and Likes
Cows
Total received
193
In last 30 days
4
Total given
344
Likes
Total received
5482
Received in last 30 days
118
Total given
201
Given in last 30 days
15
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Campbell Ritchie

I think you need to explain what you are trying to do, rather than what you are doing now, viz. trying to work out how to do it.
43 minutes ago
Highlight the entire code block and then push the code button.

What is that code supposed to do? Are you printing the ID number, or what?
Please tell us what is going wrong; I don't like having to guess.
44 minutes ago
Please explain what that means; I can only help if I know what is going wrong.
55 minutes ago
That looks like line 8 sorted out but line 15 still looks strange. And I haven't looked beyond line 15 yet.

Please have another look at the link I posted about the code button. The [code=java] part goes before the code and the [/code] part after it.
57 minutes ago
Please call a method returning the ID getId() or similar.
1 hour ago

Daniel Demesmaecker wrote:. . .equals compares the value of two string for equality.

There aren't any Strings in that line.

I would indeed look at taking a different approach, since a lot of what you're trying to do is not needed or could be simplified.

Agree that code can be simplified a lot, but let's see if we can't correct it first. OP will learn a lot more like that.
1 hour ago
The good news is, you can read about Scanner here, and in the Java™ Tutorials. You will find the equals() method is unchanged from that in Object. Please have a look at that, and don't let the five bullets scare you. The important pat is just after the 5th bullet.
The bad news is, those sources don't give a complete tutorial about how to use Scanners. You won't find much explanation about what happens if you follow next() or nextInt() by nextLine().
1 hour ago

orlagh green wrote:Hi,

Thank you for fixing it. line 8 (get(Count)) is the reference for the id number . . .

That is only half of line 8. You have overlooked half of it. Start by working out what the input.equals bit means.

I read the post you suggested and made a few changes and added in the input.nextLine() although now its not returning the right object and will only let me enter a new customer name but not sure if it will update it. i do appreciate if you can help.

Careful about these changes; you are making changes faster than I can read them and not telling me what the changes mean.

Go through the code and find every reference to your Scanner. Write down a typical set of inputs no a sheet of paper, and go through them showing where the Scanner has got to, what it is returning, and where you are using that result. Remember what I said in the old post. Also remember that many books don't give a good description of Scanner, which makes many people dislike it. I am however a Scanner‑o‑phile, but I understand that you need to know how it works before using it. Please copy what you found out about your Scanner, so we can see what is happening for ourselves.
1 hour ago

orlagh green wrote:Hi,

Thank you for fixing it. line 8 (get(Count)) is the reference for the id number . . .

That is only half of line 8. You have overlooked half of it. Start by working out what the input.equals bit means.

I read the post you suggested and made a few changes and added in the input.nextLine() although now its not returning the right object and will only let me enter a new customer name but not sure if it will update it. i do appreciate if you can help.

Careful about these changes; you are making changes faster than I can read them and not telling me what the changes mean.

Go through the code and find every reference to your Scanner. Write down a typical set of inputs no a sheet of paper, and go through them showing where the Scanner has got to, what it is returning, and where you are using that result. Remember what I said in the old post. Also remember that many books don't give a good description of Scanner, which makes many people dislike it. I am however a Scanner‑o‑phile, but I understand that you need to know how it works before using it. Please copy what you found out about your Scanner, so we can see what is happening for ourselves.
1 hour ago

orlagh green wrote:i have took out the input.next() and it runs but does not update the fields.

Please explain why you had input.next() there in the first place. But have a look at this old post first.
1 hour ago
please always use the code button; because you are new, I have edited your post with the code button, and you can see how much better it looks
Why is your method marked static?
Don';t create lots of Scanner objects to read from System.in. Create one per application and use it for everything and don't close it.
What does line 8 do? Check it very carefully. That is the first thing I noticed, so I shall stop and see what happens when you deal with line 8.
Come to think of it, isExist isn't a good name for a variable, and line 15 looks strange. Maybe found would be a better name.
1 hour ago
Welcome to the Ranch

Please show us how you are creating the ID.
2 hours ago

Harry Kar wrote:. . . Cmon Campbell please you are not a starter . . .

. . . and I have better things to do that to search for something you already know the location of.

e.g. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.140.5068&rep=rep1&type=pdf . . . .

Is that a peer‑reviewed paper? What has that got to do with the design of BlueJ? It is an assessment after BlueJ had been written, which is different from what you said earlier. You still haven't yet shown any evidence that BlueJ was designed scientifically.
11 hours ago
Welcome to the Ranch

We have a jobs forum, where I think this discussion would fit better.Moving.
12 hours ago