Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Inside an Interface

 
Vipul Gulhane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we declare class inside the interface
If Yes Then
Why we Define a Class Inside an Interface....
See I have one inteface whic have class
public interface abc
{
class a{
a()
{
System.out.println("hiii");
}
}

}


public class interfacetest implements abc{
public static void main(String a[])
{
a ss= new a();

}

}

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, better still, what did you read in the Java™ Grammar? Hint: look for interfaceMemberDecl.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic