Ryan Tracy

Ranch Hand
+ Follow
since Mar 21, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ryan Tracy

private int x is an instance variable and to use it you can call it by this.x or just x.
3 years ago
Classes are case sensitive.
4 years ago
Upper case the 'm'
4 years ago
Can you post all the code including the html? Also, use the code tags as part of your post.
Java Enterprise Edition was created to be multi-tiered. I don't think that you will even notice any degradation in performance. In fact you should notice an improvement because of the separation. Generally networks are not the bottleneck in applications. Session beans are the ones that will be doing most of the work as far as your interfaces and they are fairly light. Really the only way to probably convince you that it will be fine to do this is to actually try it. Create a simple Remote App and a local one that has a timer as part of the functionality. Also, keep in mind the ability to scale tremendously as you tier out. Many people worry about things they don't really understand. I would ultimately say give it a chance. It is not really that hard to go back if it does not work out.
I would start by properly declaring your array. Also, i would not recommend naming two variables the same name with deferent capitalization. It will just confuse you. Which i think it already has based on your code As they look like they are supposed to be the same variable.
5 years ago
Is his code expecting to receive the exceptions? If so remove the try catch for the badarray.
5 years ago
Your code is working. I see no problem with it. The exception functioned perfectly.
5 years ago
Ok, sorry I reread the initial post and we need more info. Inside your catch for badarray. Can you put e.printstacktrace() and post the stacktrace that print?
5 years ago
Ok, if i understand what you are asking. What you need to do os replace "Array is empty" with e.getMessage(). Maybe? Your question is still vague if that did not answer your question.
5 years ago
As for the exception issue. What is your question? The code is good as far as acomplishing what you described you wanted to do. Or maybe i dont understand the problem you are trying to solve.
5 years ago
Line 2 of the copy is why. When you do an assignment '=' it is not creating a new array you are telling to point to where list is at in memory. Java works by reference not value. If you would like more on this topic i suggest you ask a new question in the forums about it.
5 years ago
Your code is working perfectly. Your copyRange() is what is throwing you off. Change your start variable to 0 and you will get the correct location returned.
5 years ago
Can you post the data that you are provinding the method? Your code seems sound.
5 years ago
There are a couple problems that I see here. But the main one that I would look into is the fact that you are using an ArrayList Collection object and using it like a java array, but then you are mixing in Collection methods such as the remove which then changes the size and index parameters. Which then you try to compensate by readjusting the size. This makes the problem you are trying to solve more complex than it needs to be. There is a rule that you might want to read up on called KISS.

The only way I could get this even to run was to change line 31 from 'for (int i = size; i > 0 ;i--)' to 'for (int i = size - 1; i > 0 ;i--)'. Once I did that I did not have any problems running the program. However, the results were inaccurate. The autoboxing worked just fine. I only had problems with array index out of bounds, but I fixed that by changing line 31.

Hope this helps.
Happy coding!!!
6 years ago