Two Laptop Bag*
The moose likes Beginning Java and the fly likes Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inner Class" Watch "Inner Class" New topic
Author

Inner Class

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
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 ]
 
 
subject: Inner Class