• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

getting confused on rule for arithmetic operators

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am currently going through the OCA 8 certification book "Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 (p. 54). Wiley. Boyarsky, Jeanne"

In the "Arithmetic Operators" section of chapter 2, the book states:

All of the arithmetic operators may be applied to any Java primitives, except boolean and String



I am getting a bit confused by this statement because String is not a Java primitive type. Further, the book itself states later than "+" can be used with String to achieve concatenation.

What am I missing here? I would greatly appreciate your guidance in understanding the rule that book stated.

Thanks

 
J Zak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i just reviewed the errata at this link https://www.selikoff.net/java-oca-8-programmer-i-study-guide/  and it states:

In the third to last paragraph, “except boolean and String” should be “except boolean” since String is not a primitive

 
Ranch Hand
Posts: 41
Android Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String is categorized under "Reference types and values" in the spec.
https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.3.3

It is definitely not a primitive.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic