• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Possible errata in OCP Programmer 1 1Z0-815 - p. 52, 57

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First:
On p. 52, I read (highlighting mine):
"Variables passed to a constructor or method are called constructor parameters or method parameters, respectively. These parameters are local variables that have been pre-initialized."
On p. 57:
"In this example, a and b are method parameters. These are not local variables."

It seems to me method parameters can either be local variables, or they are not.

Second:
On p. 57, after an example showing that you can have and in the same class:
"Java is not case sensitive, ..."

Regards
 
Marshal
Posts: 78406
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid somebody else noticed the bit about not case sensitive last week; she has beaten you to it!
The Java® Language Specification (=JLS) describes method parameters and local variables in different sections Maybe that means that parameters and local variables are different; not certain myself.
 
Saloon Keeper
Posts: 3847
42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

P Bakker wrote:First:
On p. 52, I read (highlighting mine):
"Variables passed to a constructor or method are called constructor parameters or method parameters, respectively. These parameters are local variables that have been pre-initialized."



That's the official Oracle position on this https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
 
Master Rancher
Posts: 4609
61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mikalai, in the tutorial section you quoted, it says

The important thing to remember is that parameters are always classified as "variables" not "fields".


Note that they do not say local variables, just variables.  So variable is a general category, and local variables and parameters are two different types of variable.  One could argue that a parameter is like a local variable, more thana class or instanc evariable - but they're still not the same thing.

As far as P Bakker's original point, it's a fair point to note that the book is contradicting itself in those two quotes.  I would say it's best to change this one:

These parameters are local variables that have been pre-initialized.


to either drop the "local", or add "like": "these parameters are like local variables."
 
author & internet detective
Posts: 41762
885
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
Confirmed and added Mike's fix to the errata.

Also, welcome to CodeRanch!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic