Nigel Foley

Greenhorn
+ Follow
since Dec 08, 2012
Nigel likes ...
Eclipse IDE Java Ubuntu
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nigel Foley

Hi all,

Thanks for all the responses and links, its makes much more sense now

Nigel
11 years ago
Hi All,

I was reading about collections tonight and came across the following code to declare an ArrayList, I have a few questions and I am hoping that someone might be able to help me out





This first example uses the ArrayList class and the second the List interface, what are the pros and cons for each approach?

Any info / links would be greatly appreciated

Thanks
Nigel
11 years ago
Hi Fred,

Thank you very much for the quick accurate response I really apprecriate it,
my issue is now resolved and the method is returning the customer name :-)

Nigel
11 years ago
Hi All,

I have an issue trying to return the result from the method below and I am hoping that somebody might be able to spare a little time to assist me.

I have a standard pojo Customer class with three instance variables, constructors, setters and getters



I have created a vector called CustomerVector and populated it with customers.
I want to iterate through the vector to find the customer object that has the same customerId as the int that is passed into the method.



However when I try to return the result the return statement can not see the result String.

Any help to get around this issue would be greatly appreciated

Thanks in advance
Nigel
11 years ago
Hi Henry,

Thanks for pointing me in the right direction, I changed up the constructor to use the 'this' keyword(now I reference the current object) and everything work fine.

Nigel
11 years ago
Hi All,

I am new to this forum/java programming so I apologise in advance if I explain this incorrectly

I have a main method that takes values from the scanner and passes them to the customer object


}

When I run this code the customer object is instantiated but it is set to default field values and not to the values that are picked up by the scanner.
I have found a similar thread https://coderanch.com/t/408970/java/java/passing-arguments-constructor
but don't quite understand what is going on.

I would really appreciate it, if somebody could spare time to have a look and help me out

Thanks
Nigel

I have attached the associated Customer code below in case it is needed.








11 years ago