• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

OCP Java SE 11 Programmer I Study Guide (Sybex) Possible Errata Chapter 4 questions

 
Jesse Silverman
Saloon Keeper
Posts: 1328
40
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a question at the end of Chapter 4 of the Sybex 815 book that wants you to consider var as a data type to get the correct answer.

It would likely just be a re-wording (both of the answer and the question).

I was unsure enough about whether this is even bad that I asked it outside of this forum a couple of weeks back:
https://coderanch.com/t/745639/java/var-considered-data-type

I think it is good to avoid phrasing that suggests that var itself denotes a data type, especially because similar syntax is used to very different effect in other languages people may be coming from.

 
Mikalai Zaikin
Bartender
Posts: 3729
39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JEP 286 clearly says var is not a "type" or "keyword", rather "reserved type name"
 
Jeanne Boyarsky
author & internet detective
Posts: 40747
827
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
I agree it isn't a type. We couldn't think of good wording for this question. Luckily, the question isn't about whether var is a type, but whether it can be in a switch statement.
 
Jesse Silverman
Saloon Keeper
Posts: 1328
40
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think good questions that work var in would just show it as a possible choice for a fill-in-the-blank somewhere which would do an end-run over whether it was a type or not.

That would be true wherever it is used.  While there is an answer ("No") to "Is var a type?" it is 50 times more important to know how and where it can be used than that trivia answer.

It reminds me of "Is a virus alive?" Experts who could fill a textbook with correct information about viruses don't agree on that answer, but are good to have on the team when facing a pandemic.
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic