Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compilation problem with inner classes

 
Vijay Gade
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In the following code, please help in finding the error. I get a compilation error at lines 16 and 17.

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both lines are wrong in multiple ways. The following lines are correct:

TopClass.InnerClass something = tlcObj.makeInnerInst();
TopClass.InnerClass somethingElse = tlcObj.new InnerClass();
 
Vijay Gade
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I just realized while taking another look into my code that I did not, foolishly of course, define an object. Thank you very much for your reply, and I am sorry for having wasted your valuable time on such a silly mistake. Please excuse me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic