• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Nested Classes Test

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Which line does not result in a compile-time error?
a. 1
b. 2
c. 3
d. 4
e. None of the above
I would say d but apparently the answer is a. Surely abstract + final is a big no no!?
[ November 17, 2003: Message edited by: Eddie Long ]
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is one of those tricky worded questions...
Which line does not result in a compile-time error?

just try running the code to see what the compiler says if you want to double check:
 
Eddie Long
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Jess.
Sun's trying to turn me into a walking compiler! otherwise i don't see how spotting that kind of mistake makes you a better Java Programmer
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you copile the above code why the error is shown
first in the line 3 and then in line 2 and then in line 4.
Why the error is not in the following order
error in line 2
error in line 3
error in line 4
As compiler compiles the first error it will encounter it should report the first error and then the second error. Then why line 3 is the first error it encountered instead of line 2 error.
Can someone tell me why it is like this?
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eddie,
Thank you for using my exam.


Sun's trying to turn me into a walking compiler! otherwise i don't see how spotting that kind of mistake makes you a better Java Programmer


The idea is not to learn how to spot mistakes as well as the compiler. The idea is to learn the proper use of each modifier. A programmer is far more likely to use modifiers effectively when the rules are known. Furthermore, learning the rules will help a programmer write quality code and write it quickly. A programmer that depends on coaching from the compiler is unlikely to be as productive as a programmer that does not need the coaching.
Anup,
I am not an expert on compilers, but I do know that most compilers do the job using multiple passes. I assume that the order of the error messages is influenced by the multiple pass approach to compilation.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic