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

Errata in Kindle

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using Kindle for reading the book and in several places I can find that the class declaration uses "var" instead of the Class name.

For example section 4.5 Use Local variable type inference
Class LVTITest1 is full of "var"

Please, have a look in the attached files. Thanks.




2020-11-19-12_42_06-Maria-s-Kindle-for-PC-2-OCP-Oracle-Certified-Professional-Java-SE-11-Programme.png
[Thumbnail for 2020-11-19-12_42_06-Maria-s-Kindle-for-PC-2-OCP-Oracle-Certified-Professional-Java-SE-11-Programme.png]
2020-11-19-12_36_39-Maria-s-Kindle-for-PC-2-OCP-Oracle-Certified-Professional-Java-SE-11-Programme.png
[Thumbnail for 2020-11-19-12_36_39-Maria-s-Kindle-for-PC-2-OCP-Oracle-Certified-Professional-Java-SE-11-Programme.png]
 
Bartender
Posts: 3659
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maria,

Using var instead of class name is allowed since Java 1o (but only for local variables, and along with initializing)

Please check this JEP: https://openjdk.java.net/jeps/286

If you still consider there is an error in the book, please share your concerns

Thanks,
MZ
 
Mg Aral
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mikalaj, thanks a lot for your reply.

I was not aware that you can use var. I haven't been working with Java since 2017 and I am now reviewing everything from scratch. I haven't arrived to the section of variable inference.

Thanks again!!
 
Marshal
Posts: 71070
292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maria Lara wrote:. . . I haven't been working with Java since 2017 . . .

I think var was introduced about March 2018.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic