Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface within a class

 
Sricharan Modali
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I havent seen any explanation on Interfaces with classes in K&B and there are
quite a few quesions in the mock exams on this issue. I just wanted all of u to look in to this topic.
--Sricharan
 
Giuoco Krag
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many of the topics I've seen on interfaces are based on casting and converting objects (implements vs. extends in a casting situation).
Is this the direction you would like to explore?
I'd like to futher my knowledge in the rules for casting objects as well as runtime converting objects too.
 
Sricharan Modali
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
What i meant was questions like these
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. A class that implements an interface must implement all of the methods
declared within the interface.
e. None of the above.
The answer is d
For this kind of a question we need to be aware that this is possible..
interface I
{
public class Inner
{

}
interface InnerInterface
{

public void hi();
}
}
and even this ....
public class ClassName
{
public static void main(String[] args)
{
ClassName cn = new ClassName

}
interface Inclass
{

}

}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic