Forums Register Login

Constructors Compile Error

+Pie Number of slices to send: Send
Why Can't I create this constructor? What is going wrong?


+Pie Number of slices to send: Send
Because your constructor has invalid syntax. Take a close look to your constructor and see if you can spot the problem.
+Pie Number of slices to send: Send
 

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!
+Pie Number of slices to send: Send
 

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).
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 579 times.
Similar Threads
Java lang error
Implicit Import is not working - import planets.*; not working.........
Probable error on 1-3 exercise on OCA Java SE 7 Programmer I Study Guide (Robert Liguori)
Mouse shift event coding - to trigger a predetermined sequence of images to a GUI
<indentifier> expected
Overloading with Varargs
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:41:23.