• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Local Inner Class

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I knew that Local Inner class can be abstract but when i run the following code i get a compile time error . cam somebody throw light on this?
Error:
Superclass abc of local class InLocalClass (Test6. 1$InLocalClass) not found.

Its confusing Plz calrify this
public class Test6 {
public static void main(String args[]){
}
public void doSomethin(){
abstract class abc {}
class InLocalClass extends abc {
}
new InLocalClass();
}
}
------------------
"Winners don't do different things
They do things differently"
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! sunil kumar,
you try given below code i try to run below code on jdk1.2 without error...
public class Test6 {
public static void main(String args[]) {}
public void doSomethin(){
abstract class abc {}
class InLocalClass extends abc {}
new InLocalClass();
}
}
hope this help
Aftab Abbasi
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got compiler error.
It looks like " abstract" does not couse the problem, but ability to access parent class. Local inner class cannot access anything from local context, but final variables.
If you will move parent class outside of method it will compile .
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic