• 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

interface

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in one of dan chisolms exams this question was there

Which of the following statements is not true?

a. An interface that is declared within the body of a class or interface is known as a nested interface.

b. A constant can be a member of an interface.

c. A class declaration can be a member of an interface.

d. If an interface is named in the implements clause of a class, then the
class must implement all of the methods declared within the interface.

e. None of the above.


the answer is d


but this code compiles fine

interface itf
{
class sd
{
void go()
{
System.out.println("go");

}


}


}

here class declaration is a member of interface

so if i am correct then c should also be one of the answers
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
b and c are true; the rest are false.


If an interface is named in the implements clause of a class, then the
class must implement all of the methods declared within the interface.



Wrong.

 
shandilya popuru
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya so did i think but i forgot about abstract classes all along so i thought d would be right

thanks for the reply
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandy - you seem to be saying that (c) is true. You are correct. Note that the question asks, which statement is not true? Since (c) is true, it should not be part of your answer.

[Tony]: b and c are true; the rest are false.

What's wrong with (a)? An interface declared within the body of a class or interface may be described as a nested interface, or a member interface. Same thing, for an interface. Optionally the word static may be included too, but it's unnecessary since interfaces are always implicitly static.

Statements (a), (b), (c) are true. Therefore since the question asks which statement is not true, the best answer is (d), as Dan said. (Since (e) would create a paradox similar to "this statement is true" - don't want to go there.)
[ February 04, 2005: Message edited by: Jim Yingst ]
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed.
An oversight on my part.
 
shandilya popuru
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops... i was thinking question asked abt which was true
 
It was the best of times. It was the worst of times. It was a 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