This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes My post lost..so once again ques from K&B(local class) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "My post lost..so once again ques from K&B(local class)" Watch "My post lost..so once again ques from K&B(local class)" New topic
Author

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

Amit Das
Ranch Hand

Joined: Mar 05, 2005
Posts: 206
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

Joined: Mar 05, 2005
Posts: 206
is there anyone who can help me out..???
Saranyan Narayanan
Ranch Hand

Joined: Mar 12, 2003
Posts: 34
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: My post lost..so once again ques from K&B(local class)