Eddie Davis

Greenhorn
+ Follow
since Jul 31, 2009
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 Eddie Davis

Jeanne I see it now! Thank you for going to the trouble of explaining this to me. Mucho appreciated!
14 years ago
In Head First Java Chapter 7 there is a puzzle where you're to add missing parts of the code to get it to compile which will then give the print result - "drift drift hoist sail " I have the proper code but I'm having trouble walking through the code to see how it prints out "drift drift hoist sail"

There is one system.print.out that is "stroke natasha" but it doesn't get printed. The code is below. Could someone tell me how this works?

Thanks!






14 years ago
Ahh, thank you! Staring me right in the face.

Again thanks so much! Now to move to Chapter 7.
14 years ago
I'm getting this error when I try to compile the code.
ArrayListMagnet.java:3: ';' expected
Public Static Void Main (String [] args) {
^
1 error
william-daviss-macbook:chapter6 topoftiger$


I know it must be something really simple but I just can't find it. Could someone point out to me what's keeping this from compiling?

Thanks!

The actual code is below:
14 years ago
Thank you! I understand now the uses and difference between ++x and x--. I also looked the correct method of posting. Thank you Campbell.
14 years ago
Why is it that the code x = x++ seems to never get implemented in the code snippet below. I can even change it to x = x-- and I get the same answer 6 14
At some point shouldn't the value get increased by 1 or in the reverse get decreased by 1 when running through the loop?

The previous conversations about the problem MixFor5 has been extremely useful and helped me work through the problems and understand what the code was doing , but I still couldn't figure out the above question. Just for reference below is the link to the other conversations. https://coderanch.com/t/410474/Beginning-Java/java/head-first-java-mixed-messages#2070028
Thanks to anyone that could answer my question.

14 years ago
Ugh, I didn't notice that I named the Java file "output.java" but the class is actually OutPut. It's working now! Thanks all of you, for helping me out. Now on to the next chapter.
14 years ago
Just one more question. (promise) I noticed that I can compile the code but when I attempt to run it I see these error's. I understand that this is just a lesson in reading a loop but mistakenly thought that since it compiled it might run and display the output.

Thanks

Errors seen in Terminal.

Exception in thread "main" java.lang.NoClassDefFoundError: output (wrong name: OutPut)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:700)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
william-daviss-macbook:Java topoftiger$







14 years ago
Ah! I see it , I finally see it! Thank you so much for sticking with me, each of you. All of your instructions, tips and code snippets helped me. It's really appreciated!
14 years ago
How did the value of y jump from 11 to 13? Thanks
14 years ago
I understand the code snippet you just provided but still don't see how we end up with 6, providing the final output of 13 15 x = 6
When the code above becomes true x (by my count) would = 8 and not 6

Sorry.
14 years ago
Thanks everyone for the help. I see stepping through the code how we get 13 and 15 now that I understand ==i and i++ but I fail to see where the 6 is coming from in the output.
14 years ago
I looked at an earlier post on this same problem but still didn't understand. How do I iterate through this to get the output 13 15 x =6
Sorry I know this is really simple. Also what is the difference between ++y and Y++. Are they both meaning y + 1

Earlier post https://coderanch.com/t/412112/Beginning-Java/java/What-output#1815575

Thank you to anyone who can explain this to me!

14 years ago
Ahh thank you. I understand now. Much appreciation to both of you helping me out with this.
14 years ago
Thank you so much for explaining this! I think I understand now. I first needed to realize that my array was filled with nulls and that each pass through would increment a value. I have one more dumb question. Wouldn't the while loop begin with 1 instead of 0 because at the bottom of the while loop we add 1 to x with x = x + 1; And wouldn't that mean the array would begin with a null and then proceed with 1 and then 2?

Sorry but I just need to get this right in my head.
14 years ago