• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Found in Table 4.3 on Page 184 (Java OCA 8 Programmer I Study Guide)

 
Suresh Regmi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Book, Calling An instance method or variable from Static Method is not Legal. I understood, that without the reference variable it would not be possible, but with object reference it is possible

How? column should be updated.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Suresh Regmi,

First of all, a warm welcome to CodeRanch!

Suresh Regmi wrote:How? column should be updated.

I agree! Especially because on the previous page in the section Static vs. Instance this case is illustrated with an example: it's suggested to invoke new Static().third(); from the (static) main method.

So both the columns Legal? and How? should be updated to Yes and Using a reference variable respectively.

Hope it helps!
Kind regards,
Roel
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suresh,
Welcome to CodeRanch!

I've noted this in the errata. I feel like this is worse than a typo/error in the book. I wanted to convey that assuming you have no reference variables, you can call a static method from an instance method but not vice versa. And that's not what the table actually conveys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic