• Post Reply Bookmark Topic Watch Topic
  • New Topic

Code from my book not working. Classes.  RSS feed

 
Werner Holt
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, I am currently at classes chapter and I am trying ro tun a code copied directly from my book in order to understand it better. For some reason it is not working and I can't figure it out, since I still don't understand this well enough..

1. On line 8 I get: return type for the method is missing.

2.On line 9 :
Multiple markers at this line :
- Constructor call must be the first statement in a
constructor
- Line breakpoint:point [line: 9] - Point()


3.Line 13 : Return type for the method is missing
I really don't get it, because this code should be an example of how these thing work.
 
Charles D. Ward
Ranch Hand
Posts: 99
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is case sensitive. Look at the name of your class and then take a look at your constructors. (btw class names should always start with a capital letter)

May I suggest you fix your indentation as well, as it's very inconsistent and makes code harder to read.
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you correct the error about capital letters you will probably find all the other errors disappear.

I presume you already know about naming conventions? If everybody sticks to conventions like, “class names always start with a capital letter,” it saves no end of confusion.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!