File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to access class defined in an interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to access class defined in an interface" Watch "how to access class defined in an interface" New topic
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: 83
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: 83
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
A class defined inside an interface is implicitly static.
amod gole
Ranch Hand

Joined: Dec 07, 2005
Posts: 83
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: 24184
    
  34

As was stated previously, such a class is implicitly static:



[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to access class defined in an interface