This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner Class

 
Siva kandasamy
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have couple of questions.
1. Why do I need interface "Contents.java" to compile "Parcel6.java"



2. How the both definitions are same.

return new Contents() {
private int i = 11;
public int value() { return i; }
};



class MyContents implements Contents {
private int i = 11;
public int value() { return i; }
}
return new MyContents();

[ January 01, 2004: Message edited by: Sivanantham kandan ]
[ January 02, 2004: Message edited by: Sivanantham kandan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic