This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "interface" Watch "interface" New topic
Author

interface

shandilya popuru
Ranch Hand

Joined: Dec 21, 2004
Posts: 95
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


sandy
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
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.



Tony Morris
Java Q&A (FAQ, Trivia)
shandilya popuru
Ranch Hand

Joined: Dec 21, 2004
Posts: 95
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

Joined: Jan 30, 2000
Posts: 18671
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 ]

"I'm not back." - Bill Harding, Twister
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Agreed.
An oversight on my part.
shandilya popuru
Ranch Hand

Joined: Dec 21, 2004
Posts: 95
oops... i was thinking question asked abt which was true
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interface
 
Similar Threads
Need your help!
interfaces
About Interfaces
interface within a class
Ambiguity on "None of the above"