• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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: 71635
312
  • Mark post as helpful
  • send pies
  • 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.
 
Bartender
Posts: 3665
38
  • Mark post as helpful
  • send pies
  • 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: 3754
48
  • Mark post as helpful
  • send pies
  • 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: 40354
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Confirmed and added Mike's fix to the errata.

Also, welcome to CodeRanch!
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic