File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access class defined in an interface

 
amarnath jha
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

You can access that class by using interface name

like

inte.ClassName o1=new inte.ClassName();
 
amod gole
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A class defined inside an interface is implicitly static.
 
amod gole
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any other information regarding the class declared in an interface
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As was stated previously, such a class is implicitly static:

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic