• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

inner classes static reference ambiguity

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



execute the preceeding code and try removing static modifier in the line 25 i.e.,

and observe the line 38 being effected i.e.,

here the method get is also non static. but compiler doesnt prompt static violation for get() where it is saying static reference violation for the method createInner(). why this disparity.

[Edited to add code tags - Paul Sturrock]
[ August 18, 2006: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think your naming policy for classes causes some readibility problems. Class names should start with an uppercase. If it starts with a lower case, static access to methods of classes resembles normal access via an object.
I tried to compile your first version of example class and it compiles.
After i removed static modifier before createInner method, compiler warns me about static method violation.

I can't see any problem. Did you really not get such violation after removing static modifier, could you check your code?
 
Arthur, where are your pants? Check under this tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic