This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Associate Certification (OCAJP 7/8) and the fly likes Constructors Compile Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7/8)
Bookmark "Constructors Compile Error" Watch "Constructors Compile Error" New topic
Author

Constructors Compile Error

Omar Jouda
Greenhorn

Joined: Jul 11, 2012
Posts: 19
Why Can't I create this constructor? What is going wrong?


Roel De Nijs
Sheriff

Joined: Jul 19, 2004
Posts: 7231
    
  29

Because your constructor has invalid syntax. Take a close look to your constructor and see if you can spot the problem.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
OCAJP 7
Omar Jouda
Greenhorn

Joined: Jul 11, 2012
Posts: 19
Roel De Nijs wrote:Because your constructor has invalid syntax. Take a close look to your constructor and see if you can spot the problem.

The parenthesis for empty parameters?
So it should be public Earth() { etc.. } .

I wrote it exactly as in a book of mine. Apparently it is wrong.

Thanks!
Roel De Nijs
Sheriff

Joined: Jul 19, 2004
Posts: 7231
    
  29

Omar Jouda wrote:The parenthesis for empty parameters?
So it should be public Earth() { etc.. } .

Exactly!

Omar Jouda wrote:I wrote it exactly as in a book of mine. Apparently it is wrong.

You always have to be careful when copying from a book. Authors do a very good job trying to make the book free of mistakes, but it's very, very dificult process and unfortunately sometimes a mistake is not seen by the author and/or the technical review team. That's why most of the books have an errata section (in the book and/or online).
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Constructors Compile Error
 
It's not a secret anymore!