This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to understand "anonymous inner classes"  RSS feed

 
Forman Smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to let the JLbale move with mouse,so i tried this:




This does not work, something wrong in line 33.

But when i tryed this that i move the code frome line 44 to line 48 and place them under line 33,it works. i find this called "anonymous inner classes", but i don't quite understand.


Who can explain this to me? Thanks!
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forman, have you discovered the Oracle tutorials? I suggest you start with the lesson on Nested Classes and work your way down to Anonymous Classes.
 
Campbell Ritchie
Sheriff
Posts: 55329
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Java8 and you can dispense with 90% of your anonymous classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!