Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
Local inner classes
preeti khane
Ranch Hand
Posts: 93
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
can local inner classes be forward referenced?
I am a little confused as to how local classes can be referenced at all... can someone give me some examples
Yi Meng
Ranch Hand
Posts: 270
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
forward reference does not apply to local class, check out the code below:
class Test { void amethod(){ //line 1 here class B { B(){ System.out.println("B"); } }; B b=new B();//line 2 } public static void main(String[] ad){ Test a=new Test(); a.amethod(); } };
It compiles and runs fine, but try place the code at //line 2 to //line 1.....
[ May 23, 2003: Message edited by: Yi Meng ]
Meng Yi
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
why local classes in a static method?
instance member of static inner class
What is use of Local inner classes?
query about method local inner classes
Inner classes -- cheat/tip sheet
More...