It seems I heard about this whole object and toString() business when I learned
Java, but this is over my head.
I am
testing this code:
Seems straight forward enough. When I first found this, I compiled and ran from my desktop. As expected (I guess) the output was
Date = Thu Aug 17 12:23:46 EDT 2006
Great! A way to get the date! So I added this to my jump drive with other archived java programs. It is embedded in several folders.
I tried to test a bit more. Keep in mind the file was a DIRECT copy of the one on the desktop. I recompiled (because I'm OCD about that) and here's what I got:
Date = Date@108786b
A memory address as opposed to the actual date. Now....why??
My first thought was removable media. I copied the file back to the desktop and got the true date again. I copied THAT file to the root of the jump drive: TRUE DATE, which kills the removable media theory.
My next test was to see if the difference occured at compile or run time. I copied a java AND class file from the desktop (compiled there) to my embedded directory: TRUE DATE. which says to me, it seems to matter WHERE i'm compiling.
Again, it works on the desktop and root of jump drive, but not inside some directories on the jump drive. Also, tests indicate that the difference is occuring at compile time.
(For some reason, I can't try the test backwards: NoClassDef Found if I copy the class and java TO the desktop, so I have to recompile which defeats the purpose)
Any ideas? I just am wondering how many times I got so frustrated at a program that wasn't working the way it was supposed to -- all because it was in some folder that Java didn't like especially well!
Thanks