• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

mock exam question.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following lines will compile when added to the Child class
without making any other changes.
public class Child {
void test() {
System.out.println("Child.test()");
}
}
Select all valid answers.

a) abstract void test_a (int i);
b) abstract void test_b (int i) { };
c) abstract void test ();
d) final void test_d (int i);
e) native void test_e (int i);
f) private abstract void test_f(int i);

The answer given is e)
Whats wrong with d)
-Thank you all...
 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem with d is that there is no method definition. The answer is e. Since e is declared native, no method definition is needed.
 
reply
    Bookmark Topic Watch Topic
  • New Topic