• 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

JQ+ question on interfaces

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following with interfaces are true: [check 2 answers]
1) Interfaces are abstract by default.
2) An Interface can have static methods.
3) Interfaces cannot be final.
4) Fields of an interface can be declared transient, volatile but not synchronized.
5) All methods in an interface are abstract, although u need not declare them to be so.
I went for 1,3
But the answer given is 1,5.
There is a mild catch i thought which made me to go for 3 rather than 5. They say u need not declare the methods as abstract in option 5. That means i thought, it is legal to declare them to be abstract (which is not so!!). So i went for option 3 which is also perfectly true. (Interfaces cannot be declared final!!).
Any help.
TIA
 
Enthuware Software Support
Posts: 4818
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your are right. Interfaces cannot be final. This was a bug in the question. I remember fixing it a couple days ago.
But it is legal to declare a method as abstract in an interface. It is not recommended to do so, though.
HTH,
Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic