aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface declaration in instance init block. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface declaration in instance init block." Watch "Interface declaration in instance init block." New topic
Author

Interface declaration in instance init block.

Meena R. Krishnan
Ranch Hand

Joined: Aug 13, 2006
Posts: 178
Is it possible to declare an interface in the instance init block?
looks like not?

I tried the following and is giving "interface can be declared only inside the top-level classes or interfaces". Isn't in the top-level class?

Mani Venkata Kanth
Ranch Hand

Joined: Aug 21, 2006
Posts: 39
Interfaces should be at the top level or

Static members of top level class.


There are no such interfaces like non-static,local and anonymous interfaces.

If the interface is in top level class,it should be in static context.

i think it helps you.
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Originally posted by k pandu:
Interfaces should be at the top level or

Static members of top level class.


There are no such interfaces like non-static,local and anonymous interfaces.

If the interface is in top level class,it should be in static context.

i think it helps you.


what do you mean by static context ?
you mean i need to declare that interface as static when ever is use it as inner class ?
and can you please tell me the advantages of declaring the interface inside the class?


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interface declaration in instance init block.