• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

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

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41763
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic