Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about Dan's mock exam (interfaces)

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
taken from Dans Exam

Compile-time errors are generated at which lines?
a. 1
b. 2
c. 3
d. 4
e. 5
f. None of the above.
I selected E, because that method (public native void m1();) is not implementing anything (notice it doesn't have curly brackets).It should be declared abstract and so the class.
all other methods have implementations (even though they only have {} ).
But Dan's answer is F (none of the above).
 
Ryan Wilson
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
native methods are like abstract (they end in ; without any {})
public native void m1();
Native uses platform specific language, therefore the code cannot be implemented in the Java method.
The code that native implements is loaded from a library somewhere on the system.
 
Robbie kyodo
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey
interface can't be final .
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Robbie kyodo:
interface can't be final .
But there is no final interface in the question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic