• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

question about Dan's mock exam (interfaces)

 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey
interface can't be final .
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Robbie kyodo:
interface can't be final .

But there is no final interface in the question.
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic