aspose file tools*
The moose likes Java in General and the fly likes Static Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Static Inner Class" Watch "Static Inner Class" New topic
Author

Static Inner Class

Paras Ahuja
Ranch Hand

Joined: May 22, 2012
Posts: 62
Hi everyone,



t.show shows error. Please help me....
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4389
    
    8

It's generally helpful to say what the errors are.

However...it's nothing to do with the fact that it's an inner class (note - it isn't a static inner class, it's just a normal inner class). The error is because you have a statement directly in a class body instead of being within a method.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

moreover, since ABC is not a static class, even if it had a method to call you need an instance of Try class in order to call it.

what you must be trying to do is have a Static inner class
public static class ABC
then you can call it like this
Try.ABC.someMethod();


SCJP
Visit my download page
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Not to add any confusion, but just to be pedantic, I don't think there is such a thing as a static inner class. Static nested class, yes, but I believe the term "inner class" is defined by the JLS to only apply to non-static nested classes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Static Inner Class