• 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

Please help resolving compilation error - code with lambda expression which returns a Comparator

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

I am trying to compile below code. It is throwing following exception. Could you please help identify what the problem is?



Compilation Error:
============

E9.java:20: error: cannot find symbol
Field field = x.getClass.getDeclaredField(fieldName);
...................^
symbol: variable getClass
location: variable x of type T
where T is a type-variable:
T extends Object declared in method <T>lexographicComparator(String...)
1 error
 
Raghavendra Desoju
Ranch Hand
Posts: 127
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,

Pardon for my typing blunder....

I found the mistake.....parenthesis is MISSING

x.getClass ().getDeclaredField(fieldName)
 
reply
    Bookmark Topic Watch Topic
  • New Topic