Win a copy of AWS Security this week in the Cloud/Virtualization 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Amount of lines of code that does not compile to answer in OCA exam

Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys. The following example is based on exercice 71 p.179 from OCA/OCP Practice Test of Scott and Jeanne.

The exercice asks about how many lines of the application does not compile. Well, in the code below i will transcribe the application and I make a change on line 13 by adding a new error changing the original name of the variable "ex" by "e".

So, leaving the code like this and running javac commmand, compiler says that there is an error on line 13: error: variable e is already defined in method make()
} catch(Exception e){

But besides this error i know there are another two on lines 10 and 23. And a proof of this is that if i fix the error from line 13, and then i run again javac, now the compiler will say that there are two compiler errors on those two lines (10 and 23).

So what would be the right answer for the exam?.
* There are one compiler error (based on what originally compiler says)

* There are three compiler errors based on what we can see about the code.

author & internet detective
Posts: 40002
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Three because that's how many things are wrong.

The real exam is more likely to ask you whether a specific line has a compiler error. Or if there are any. We like to make you count so we get you to think more. If you can solve our harder questions, you'll have no trouble on the real exam!
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic