Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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.
 
You didn't tell me he was so big. Unlike this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!