permaculture playing cards*
The moose likes Beginning Java and the fly likes Problem compiling a program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem compiling a program" Watch "Problem compiling a program" New topic
Author

Problem compiling a program

Marek Kruze
Greenhorn

Joined: Jul 02, 2009
Posts: 2
Hello everyone!
I'm trying to write a program calculating the age from the given date of birth.
I am using a ready-made source fromJava 6 Codebook, page 162 (sorry, it's German, but the code is still Java ;)
Anyway, when I try to compile the program I get an error: cannot find symbol symbol: variable MoreDate location class Geburtstag
I don't think that they made a mistake in the book, so it must be me...
The code I use is:


The variable MoreDate is nowhere, apart from this one place...
What could I do to make this work?
I left the German names unchanged not to break anything - can change if this might help.
Thank you for any of your suggestions.
Cheers.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18120
    
  39

The variable MoreDate is nowhere, apart from this one place...
What could I do to make this work?


If I have to guess, I would say it is another class.... See if the cookbook has a MoreDate class defined anywhere.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
I haven't read the book what is happening is two things.

Or you are missing the import statement of the MoreDate class.
Or you haven't written it yet in the same package this example is (default package it seems because you did not specify the package statement).

Check in your book again to see if they wrote this class before this example.


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
www.ulisespulido.com
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
Welcome to JavaRanch
You need a class called MoreDate, which has a static age() method. I see other people have already told you.
Marek Kruze
Greenhorn

Joined: Jul 02, 2009
Posts: 2
Thank you for the immediate replies. As the book is just a preview it seems that certain parts might be missing Just like the MoreDate class.
Pity, but I'll try to do it somehow different.
Thanks for now
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
Marek Kruze wrote:I am using a ready-made source fromJava 6 Codebook, page 162
Maybe if you buy the book and find page 165 or page 161 you will know where MoreDate is
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem compiling a program
 
Similar Threads
Scanner class doubt
variables not found with OOP
Code Help
how can i reformat a Date object
Making Decisions Lottery application