• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Generic Inner class doubt

 
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am studying to get strong in the use of Generics and I came into a doubt regarding the use of generic inner classes:

This is my test program:


The code compiles and runs as expected for //1 and //2.

These are the compiler messages for //3:


This one is for //4:


What is worng with those lines? How can I instantiate my inner class?

I know this problem may be beyond the actual exam level, but i would really appreciate if someone could point me to the right direction.

Thank you very much.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Code compiles fine on my machine (JDK 1.5.0_08) and produces the following output:

Outer--> One
Outer--> Two
Inner--> Two - One
Inner--> Two - Two
 
Sergio Tridente
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Strange. I am using JDK 1.5.0_11 (+ console) and still getting the same errors.

But, it certainly did work this morning at home where I was using Eclipse and JDK 1.5.0_10. Are you using Eclipse too? Or is this an 'issue' with JDK 1.5.0_11?
 
Brian Spindler
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using eclipse too.
 
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in eclipse fine, in command line errors.
I have javac 1.6.0_01, in eclipse using "compiler compliance 5.0", in console "-source 1.5"
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
found this:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6557954
 
Sergio Tridente
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you John and Brian.
[ May 30, 2007: Message edited by: Sergio Tridente ]
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic