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

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
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic