• 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

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)
 
Your mother was a hamster and your father was a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic