• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem Working An Example calling Super()  RSS feed

 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all:

I am killing some time reviewing simple java examples and expanding on thems. I am have trouble with the follow example:



I don't understand how to properly call the BaseBall method.

Source:
Page 287, 288 Java All-in-one desk reference for Dummies, 2nd Edition

Thanks.

Preston@Large
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What method? Your classes don't have any methods. They have constructors, and you already call that one on line 34 (new BaseBall()). After that the object is constructed and you can't call the constructor on it anymore.
 
ankur trapasiya
Ranch Hand
Posts: 160
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here there are no methods named BaseBall. You are trying to call a constructor which is not possible....
 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep! You're right! Thanks.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and it would be a bad idea to write a method that looks so similar to a constructor.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!