| Author |
how to access class defined in an interface
|
amarnath jha
Greenhorn
Joined: Aug 07, 2006
Posts: 18
|
|
how can i access a class defined in an interface? public interface abc { static int i=0; void dd(); class a1 { a1() { int j; System.out.println("inside"); } public static void main(String a1[]) { System.out.println("in interfia"); } } }
|
 |
amod gole
Ranch Hand
Joined: Dec 07, 2005
Posts: 81
|
|
Hi all, You can access that class by using interface name like inte.ClassName o1=new inte.ClassName();
|
 |
amod gole
Ranch Hand
Joined: Dec 07, 2005
Posts: 81
|
|
hi amarnath jha , You can also defind interface inside class then question is how to access that interface? again same rule class name . interface name Enjoy
|
 |
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
|
posted

0
|
|
A class defined inside an interface is implicitly static.
|
 |
amod gole
Ranch Hand
Joined: Dec 07, 2005
Posts: 81
|
|
wise owen exactly...... inner class always behave like an data variable of that class and by default all variable which are declared in interface are final and static... this means that ,that class is also static class so you can access that class using inteace name
|
 |
amarnath jha
Greenhorn
Joined: Aug 07, 2006
Posts: 18
|
|
|
any other information regarding the class declared in an interface
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24045
|
|
As was stated previously, such a class is implicitly static:
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: how to access class defined in an interface
|
|
|