Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

interface  RSS feed

 
Ranch Hand
Posts: 95
  • 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
 
Ranch Hand
Posts: 1608
  • 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
  • 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
 
Wanderer
Sheriff
Posts: 18671
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed.
An oversight on my part.
 
shandilya popuru
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops... i was thinking question asked abt which was true
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!