• 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

My post lost..so once again ques from K&B(local class)

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

K&B Ch 8(Inner Classes page 466)

But even after the method completes,
the inner class object created within it might still be alive on the heap if, for
example, a reference to it was passed into some other code and then stored in an
instance variable



how do we do this. I tried to do sth like this:


how is it possible to have an object of rutime-type object as that of the inner class or may be its extension as in the case mentioned above???

also i'm not able to understand the o/p of this line:
System.out.println(mi.getClass().getName()); //MyOuter2$1 ???

why i'm not geeting anything like MyInner$1???

and since i'm catching the argument-local anonymous class, polymorphically as type Object, how can we say that the oject created inside the method outlives the method invocation???

plz help me out??

thanx
amit
 
Amit Das
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there anyone who can help me out..???
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see it as
1) this here used to invoke check is seen as a MyOuter because of ch being invoked as an object of MyOuter.
I hope this answers part 1
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read 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