• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface

 
shandilya popuru
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Tony Morris
Ranch Hand
Posts: 1608
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed.
An oversight on my part.
 
shandilya popuru
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops... i was thinking question asked abt which was true
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic