*
The moose likes Java in General and the fly likes compilation problem with inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "compilation problem with inner classes" Watch "compilation problem with inner classes" New topic
Author

compilation problem with inner classes

Vijay Gade
Ranch Hand

Joined: Jul 04, 2005
Posts: 81
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

Joined: Jul 08, 2003
Posts: 24183
    
  34

Both lines are wrong in multiple ways. The following lines are correct:

TopClass.InnerClass something = tlcObj.makeInnerInst();
TopClass.InnerClass somethingElse = tlcObj.new InnerClass();


[Jess in Action][AskingGoodQuestions]
Vijay Gade
Ranch Hand

Joined: Jul 04, 2005
Posts: 81
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.
 
 
subject: compilation problem with inner classes
 
Similar Threads
classes with private constructors can not be subclassed?
overriding constructor of inner class
Problem with generics
Nested & Inner class