aspose 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
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 35257
    
    7
You can't have code (like an assignment) outside of methods, unless they're part of a field declaration, or in a static initializer.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous Classes Implementing An Interface Issue
 
Similar Threads
More about Separated Interface Pattern and layered design
Can't understand the Output
Why public?
Java beginner- interface
Cyclic class