Results 1 to 11 of 11
Thread: Stuck on step 5
- 11-01-2011, 12:24 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 34
- Rep Power
- 0
- 11-01-2011, 01:27 AM #2
Re: Stuck on step 5
What is wrong with the above line of code? What similar problem do you have in your code? Fix the first error and the second will probably disappear. For the third error it says it cannot find the variable 'i'. Where have you declared it?Java Code:System.out.println(String word);
- 11-01-2011, 02:14 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 34
- Rep Power
- 0
Re: Stuck on step 5
I figured out the first one but I seriously can't see what you mean with the second, and I feel stupid. >.>
- 11-01-2011, 02:19 AM #4
Re: Stuck on step 5
In the first print statement you are using the variable 'i' to access an element of the values array. Where have you declared the 'i' variable?Java Code:public void drawHor() { // step 8: // draw horizontal bar graph (one line per roll value) for(int d = 1; d < values.length; d++) System.out.print("Count " + d + ":" + "\t" + values[i]); System.out.println("*"); }
- 11-01-2011, 02:25 AM #5
Member
- Join Date
- Oct 2011
- Posts
- 34
- Rep Power
- 0
Re: Stuck on step 5
I fixed that one already. The other two (step 5) is where I am stuck. That error was from me not paying attention. I honestly don't know how to fix the other two.
- 11-01-2011, 02:41 AM #6
Re: Stuck on step 5
I'm confused. You keep saying you have fixed things. What are your current errors?
- 11-01-2011, 03:41 AM #7
Member
- Join Date
- Oct 2011
- Posts
- 34
- Rep Power
- 0
Re: Stuck on step 5
asfasdfasdfasdf
Last edited by scd250; 11-07-2011 at 08:18 AM.
- 11-01-2011, 03:55 AM #8
Re: Stuck on step 5
Did you read the error messages? You are making a static call when the method is not static. What does that mean? Imagine you have a Person class. Each Person has a name. There are billions of Person objects in the world. If you say "print Person.name" which name should be printed? Your error relates specifically to this line:
Surely you can work it out yourself.Java Code:Histogram.drawHor();
As for the warnings you can either fix them or ignore them. If you code only has warnings and no errors, it will still compile and run. Ideally you would fix them in the long run but it is upto you.
- 11-01-2011, 04:13 AM #9
Member
- Join Date
- Oct 2011
- Posts
- 34
- Rep Power
- 0
Re: Stuck on step 5
asdfasdfsadfasdf
Last edited by scd250; 11-07-2011 at 08:18 AM.
- 11-01-2011, 09:07 AM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,424
- Blog Entries
- 7
- Rep Power
- 17
Re: Stuck on step 5
Those methods don't take any parameter; you are trying to pass an array of ints as a parameter; the compiler doesn't like that.
kidn regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-01-2011, 06:57 PM #11
Member
- Join Date
- Oct 2011
- Posts
- 34
- Rep Power
- 0
Similar Threads
-
how to operate a graph step by step clicking the jbutton?
By cibip in forum New To JavaReplies: 1Last Post: 08-18-2011, 07:47 PM -
Step-by-Step Billing system in Web Services
By oneofthelions in forum Web FrameworksReplies: 2Last Post: 12-18-2009, 10:28 AM -
EJB3 Message driven beans step-by-step guide
By nix123456 in forum Enterprise JavaBeans (EJB)Replies: 3Last Post: 09-28-2009, 01:29 PM -
Step-by-Step Tutorial: Achieve RAD with Seam+Eclipse+Tomcat
By Techieexchange in forum JavaServer Faces (JSF)Replies: 0Last Post: 11-13-2007, 07:13 PM -
Step-by-Step 0.95
By JavaBean in forum Java SoftwareReplies: 0Last Post: 07-14-2007, 08:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks