• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Interface declaration in instance init block.

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic