This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Anonymous Classes Implementing An Interface Issue  RSS feed

 
Ehsan Rahman
Ranch Hand
Posts: 59
Chrome Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Chad Cook
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error message(s) are you receiving?
 
Ehsan Rahman
Ranch Hand
Posts: 59
Chrome Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When compiling:



The following compiler error message appears:

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't have code (like an assignment) outside of methods, unless they're part of a field declaration, or in a static initializer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!