File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
An inner class in an Interface
Abhinav satyam Gupta
Joined: Aug 15, 2008
Aug 17, 2008 07:13:00
I also have one query on the same...
An inner class in an Interface...
here is a sample..
class test_class implements Test
public static void main(
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...
Joined: Oct 27, 2005
Aug 17, 2008 08:03:00
Like fields, all inner classes inside interfaces are automatically public and static.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: An inner class in an Interface
Static nested Interface
Can I write static methods in an Interface?
Inner class concept
Inner static class as test harness
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014