wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes An inner class in an Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "An inner class in an Interface" Watch "An inner class in an Interface" New topic

An inner class in an Interface

Abhinav satyam Gupta

Joined: Aug 15, 2008
Posts: 2
Hi Everyone..
I also have one query on the same...
An inner class in an Interface...
here is a sample..
interface Test
class Inner_test

class test_class implements Test
public static void main(String []arg)
Inner_test in_t = new Inner_test();

This works fine... but my query is how can it work??
we are making an object of non-static class in static context.
which should return compilation errror....

May be i am overconcerned because of which i have overlooked an imp concepts....
But what i think it can work only when Inner_test is implicitly static in the interface. but IS IT???

waiting for reply...
Rob Spoor

Joined: Oct 27, 2005
Posts: 19790

Like fields, all inner classes inside interfaces are automatically public and static.

How To Ask Questions How To Answer Questions
I agree. Here's the link: http://aspose.com/file-tools
subject: An inner class in an Interface