• 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

Generics of Class Class

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(Question about Java Tiger)

I thought it is possible to change e.g. TestA.class into Class<TestA>

but when i try this in following code:


My compiler is giving an error at the ">": "Syntax error on token ">", Expression expected after this token". I don't get why it's giving me that error.

Compiler i use is Eclipse 3.1.1 and MyEclipse 4.0.1. I also changed the compiler settings to compile according to Java 5.0 because with other generics (e.g. HashMap<String, String> ;) i don't have any problem at all


(disabled smilies)
[ November 28, 2005: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the Java Language Specification, Class<TestA> is the type of the class literal TestA.class. That is not the same thing as TestA.class itself.
[ November 28, 2005: Message edited by: Barry Gaunt ]
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, you are right

Thanks for the explanation
 
reply
    Bookmark Topic Watch Topic
  • New Topic