File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Anonymous Classes Implementing An Interface Issue 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 "Anonymous Classes Implementing An Interface Issue" Watch "Anonymous Classes Implementing An Interface Issue" New topic
Author

Anonymous Classes Implementing An Interface Issue

Ehsan Rahman
Ranch Hand

Joined: Feb 16, 2009
Posts: 59

Hi Everyone,

Hope you are having a good day/night. Stumbled upon another anonymouse class issue:



Please could someone explain why assignment to A works but the assignment to B (by not assigning immediately) doesn't work.

Many Thanks,
Ehsan


SCJP 1.5, SCJD 1.6
Chad Cook
Greenhorn

Joined: Dec 02, 2004
Posts: 29
What error message(s) are you receiving?
Ehsan Rahman
Ranch Hand

Joined: Feb 16, 2009
Posts: 59

When compiling:



The following compiler error message appears:

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42360
    
  64
You can't have code (like an assignment) outside of methods, unless they're part of a field declaration, or in a static initializer.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous Classes Implementing An Interface Issue