• 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
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Wrong answer to a question in Sybex

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is from the book OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808, Practice exam 2 on http://sybextestbanks.wiley.com/.

What is the result of the following?



The given correct answer:
An exception is thrown.

The correct answer:
The code fails to compile for another reason.



 
Ranch Hand
Posts: 209
13
VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the '7:' on line 4 supposed to be there? It looks like a line reference that's not supposed to be part of the code.

If you remove the '7:', the code will compile but throw an exception at run time.
 
author & internet detective
Posts: 39343
755
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an errata and was originally reported here. (It's proving difficult to get it fixed online.) There should be a linebreak before "7:"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!