Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

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
  • 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
  • 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: 39790
797
Eclipse IDE VI Editor Java
  • 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.
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!