• 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:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

getting confused on rule for arithmetic operators  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!