Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Outer instance for static nested class

 
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a query regarding nested classes. Following is my code.



a. At Line 1, no error.
b. At line 2, compiler says>>> "qualified new of static class."

Both are static members of Outer class. Although no outer instance is required to access any static member from any other member of outer class. But if I access static members by ny Outer instance, for variables and methods its ok but not for static nested classes.

WHY SUCH DISCREPANCY?


Thanks & Regards

Naseem.K
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a good question. I am also waiting for the replys.
I already posted the same question but i didn't get any reply.
I need help
 
Sreeraj Harilal
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.
My question link was wrong.
Here is the correct one
Inner Class
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I only know that a nested class (static) does not hold an implicit reference "this" to its enclosing class, but a static method does.
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic