This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin Cookbook and have Ken Kousen on-line!
See this thread for details.
Win a copy of Kotlin Cookbook this week in the Kotlin 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

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: 67036
255
  • 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.
 
Rancher
Posts: 3542
37
  • 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
 
Rancher
Posts: 3412
34
  • 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: 39771
797
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!
 
Don't MAKE me come back there with this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!