File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem compiling a program

 
Marek Kruze
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulises Pulido
Ranch Hand
Posts: 81
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic